0
$\begingroup$

I have a text document containing three columns. One column is "sex", and each value is either "M" or "F". The other two columns contain numerical data (my explanatory variable and response variable).

I want to create a Scatterplot in R where the point will look different for males than for females. I don't know how to do this.

$\endgroup$

marked as duplicate by Nick Cox, gung, Glen_b r Mar 1 '15 at 1:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    $\begingroup$ I'm voting to close this question as off-topic because it is a request for advice on coding in R. $\endgroup$ – Nick Cox Mar 1 '15 at 0:10
  • $\begingroup$ You need a small reproducible example - a small set of data in R that you call dput on so that people attempting an answer can make the same data. In plot, the col argument gives different colors, the pch argument can get different symbols (including letters). $\endgroup$ – Glen_b Mar 1 '15 at 1:04
  • $\begingroup$ Here's an example that uses both color and symbols plot(Sepal.Length~Sepal.Width,iris,col=Species,pch=as.numeric(Species)) and heres one with color and letters plot(Sepal.Length~Sepal.Width,iris,col=Species,pch=as.character(Species)) (but it's not so successful, since two species start with 'v') $\endgroup$ – Glen_b Mar 1 '15 at 1:13

Browse other questions tagged or ask your own question.