Re: [R] Scatterplot with data grouped by color

2008-09-13 Thread Jim Lemon
Amanda Young wrote: Hi, I am a complete R rookie so this question is probably really simple but I haven't found an answer on the web that I can understand. My data frame has 3 columns, A, B and C. A and B have numbers (about 8000 rows), C is a factor which is either true or false. So I can

Re: [R] Scatterplot with data grouped by color

2008-09-13 Thread Martin Maechler
JIV == Jorge Ivan Velez [EMAIL PROTECTED] on Fri, 12 Sep 2008 18:39:04 -0400 writes: JIV Dear Amanda, JIV Try this: JIV # Data set JIV set.seed(123) JIV DF=data.frame(A=rnorm(10),B=rpois(10,10),C=sample(1:3,10,replace=T)) JIV attach(DF) JIV # Plot JIV

[R] Scatterplot with data grouped by color

2008-09-12 Thread Amanda Young
Hi, I am a complete R rookie so this question is probably really simple but I haven't found an answer on the web that I can understand. My data frame has 3 columns, A, B and C. A and B have numbers (about 8000 rows), C is a factor which is either true or false. So I can plot A vs B with

Re: [R] Scatterplot with data grouped by color

2008-09-12 Thread Henrik Bengtsson
See argument 'col' to plot()/points(). Setup a 'col' vector of length equal to the number of data points and have the 'C' variable specify the colors of the individual elements. Then call plot()/points() with argument 'col'. My $.02 /HB On Fri, Sep 12, 2008 at 3:29 PM, Amanda Young [EMAIL

Re: [R] Scatterplot with data grouped by color

2008-09-12 Thread Jorge Ivan Velez
Dear Amanda, Try this: # Data set set.seed(123) DF=data.frame(A=rnorm(10),B=rpois(10,10),C=sample(1:3,10,replace=T)) attach(DF) # Plot plot(A,B,pch=16,col=C) legend('topleft',paste('Group',1:3,sep= ),col=1:3,pch=16) HTH, Jorge On Fri, Sep 12, 2008 at 6:29 PM, Amanda Young [EMAIL PROTECTED]

Re: [R] Scatterplot with data grouped by color

2008-09-12 Thread hadley wickham
On Fri, Sep 12, 2008 at 5:29 PM, Amanda Young [EMAIL PROTECTED] wrote: Hi, I am a complete R rookie so this question is probably really simple but I haven't found an answer on the web that I can understand. My data frame has 3 columns, A, B and C. A and B have numbers (about 8000 rows), C is