[R] different plot symbols according to a factor

Deepayan Sarkar deepayan at stat.wisc.edu
Fri Jan 24 21:59:03 CET 2003


On Friday 24 January 2003 02:50 pm, Frank Mattes wrote:
> Dear R list subscriber,
>
> I'm hoppiing my question didn't come up so far. I try to do somthing simple
>
>   a<-c(1,4,5,2,7,34,56,78,76,54)
> b=c(a<-c(1,4,5,2,7,34,56,78,76,54)

???

> c<-c(0,0,0,0,0,1,1,1,1,1)
>
> I would like to get a scatter diagram with different plot symbol for 0 and
> 1 in c
> I tried
>
> plot(a,b, pch=c(1,2)[c])

R indexing starts from 1. So, try 

plot(a,b, pch=c(1,2)[c+1])

>
> which didn't work.
>
> I appreciate if someone from the list could direct me in the right
> direction
>
> Yours
> Frank
>
> Frank Mattes, MD
> Department of Virology
> Royal Free and University Medical School
> London
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list