Re: [R] xyplot with all columns of a data.frame on a single plot

2010-07-27 Thread Rajarshi Guha
Thanks to everybody for the solutions. On Tue, Jul 27, 2010 at 3:47 AM, Dennis Murphy wrote: > Hi: > > Another approach might be to use the melt() function in package reshape > before creating the plot with xyplot, something along the lines of the > following: > > library(reshape) > mdat <- melt(

Re: [R] xyplot with all columns of a data.frame on a single plot

2010-07-27 Thread Phil Spector
One of the nice features of R's formula syntax is that you can create a character string containing a formula, and pass it to the formula() function. For example: xyplot(formula(paste(paste(paste('D',1:10,sep=''),collapse='+'),'X',sep='~')),data) will do what you want.

Re: [R] xyplot with all columns of a data.frame on a single plot

2010-07-27 Thread Dennis Murphy
Hi: Another approach might be to use the melt() function in package reshape before creating the plot with xyplot, something along the lines of the following: library(reshape) mdat <- melt(data, id = 'X') This should create a data frame with three columns: X, variable (all the D* names as factor

Re: [R] xyplot with all columns of a data.frame on a single plot

2010-07-26 Thread Felix Andrews
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 = functi