0

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.

  • 1
    I'm voting to close this question as off-topic because it is a request for advice on coding in R. – Nick Cox Mar 01 '15 at 00:10
  • 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). – Glen_b Mar 01 '15 at 01:04
  • 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') – Glen_b Mar 01 '15 at 01:13

0 Answers0