To differentiate between groups on the barplot, I guessed that col = colr[test$group] would have worked. How can I do this?
Many Thanks Murray test <- structure(list(patient = 1:20, score = c(100, 95, 80, 75, 64, 43, 42, 40, 37, 35, 30, 29, 27, 26, 23, 22, 19, 18, 17, 16), group = c(1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0)), .Names = c("patient", "score", "group"), class = "data.frame", row.names = 1:20) attach(test) colr <- c("gray","pink") barplot(score,beside = T,space = .4,col = colr[test$group]) -- Murray Pung Statistician, Datapharm Australia Pty Ltd 0404 273 283 [[alternative HTML version deleted]] ______________________________________________ R-help@stat.math.ethz.ch 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.