One method: dd <- do.call(make.groups, mydata[,-1]) dd$X <- mydata$X xyplot(data ~ X | which, dd)
Another method: form <- paste(paste(colnames(mydata)[-1], collapse = " + "), "~ X") xyplot(as.formula(form), mydata) Yet another method: library(latticeExtra) xyplot.list(mydata[,-1], FUN = function(z, ...) xyplot(z ~ mydata$X, ...)) On 27 July 2010 12:26, Rajarshi Guha <rajarshi.g...@gmail.com> wrote: > Hi, I have a data.frame with columns named X, D1, D2, D3 > > I know I can get a single plot with 3 curves by doing > > xyplot(D1 + D2 + D3 ~ X, data) > > but in some cases I might have columns D1 ... D10. > > Is there a way to plot all 10 columns without having to specify each > individual term? > > (By analogy with formulae in lm, I thought, xyplot(. ~ X, data) would > work, but it didn't) > > Thanks, > > -- > Rajarshi Guha > NIH Chemical Genomics Center > > ______________________________________________ > 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. > -- Felix Andrews / 安福立 http://www.neurofractal.org/felix/ ______________________________________________ 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.