Hello R-users Kindly assist me with the following plot problem in R- My data looks like this (shortened because I have about 5000 observations). dat <- read.table(textConnection("Id Time Y 1 0 194 1 5.22 179 1 5.97 190 2 1.61 265 2 2.1 234 2 16.4 300 2 29.5 345 3 0 212 3 0.36 213 4 0 199 4 1.23 203 5 0 212 5 13.5 216 6 0 222 6 1.6 234" ), header = TRUE) closeAllConnections() The measurements are not taken at equal time points. I want to avoid overly cluttered plots in making individual profile. So, I will like the profile plot to appear grey (not completely visible) and about 30 randomly selected 'lucky subjects' to appear dark(very visible). The code below was proposed but failed to do the job right! attach(dat) plot(Time, Y, type="n") subjects <- unique(Id) dark <- subjects %in% sample(subjects, 3) for (subject in subjects){ which <- subject == Id lines(Time[which], Y[which], pch=as.character(subject), type="b", col=if(dark[subject]) "black" else "gray50") } Thanks.
[[alternative HTML version deleted]]
______________________________________________ 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.