[R] Grouping stripchart markers

Sam Player samtplayer at gmail.com
Sun Feb 15 08:32:32 CET 2009


If I have a dataset grouped into 3 classes, how can I construct a 
stripchart where the markers are different for each class, e.g. a cross 
for 1, square for 2 and circle for 3. In the example below I try to 
define the marker type by the class but this only changes all the 
markers from the default squares into circles. I am assuming I need to 
set pch as an argument in par but am unsure how to proceed.

data <- rnorm(9)
class <- c(1,1,1,2,2,2,3,3,3)
x <- data.frame(data,class)
stripchart(x[,1], pch=x[,2])

Thanks,

Sam.




More information about the R-help mailing list