Hi All.

I have the commands below to create a stripchart/plot.  I was hoping to
color the points in the plot by yr, and use a symbol that varied with resp.
However, the outcome makes it appear as though the point by point col and
pch data is not being passed properly.  Any suggestions?

And truthfully, I¹d rather be doing this with Lattice, but I¹ve tried
several variations of stripplot and can¹t even get something with the
general layout of the stripchart version.

Thanks, Bryan
*************
Bryan Hanson
Professor of Chemistry & Biochemistry
DePauw University, Greencastle IN USA

index <- round(runif(100, 1, 100))
resp <- rbinom(100, 1, 0.5)
yr <- rep(c("2005", "2006"), 50)
all <- data.frame(index, resp, yr)
for (n in 1:length(all$index)) {
    if (all$yr[n] == 2005) {all$col[n] <- "red"}
    else {all$col[n] <- "blue"}
    }
for (n in 1:length(all$index)) {
    if (all$resp[n] == 1) {all$sym[n] <- 1}
    else {all$sym[n] <- 3}
    }
stripchart(all$index, method = "stack", ylim = c(0,10), col = all$col, pch =
all$sym)

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to