Dear R users,

Is it possible to draw an xyplot (example below) without having to build a 
dataframe?
For example: I have some data in matrix-form. Usually, the first column is the 
x-value, the columns 2 and 3 are y-values. I would then like to plot 2 panels 
where the first panel draws the second column against the first column and the 
second panel draws the third column against the first column. It seems 
"tedious" to construct a dataframe just for the plots.

Cheers,

Marius

library(lattice)

x <- 1:10
y <- cbind(x,-x) # 2-column matrix
p <- cbind(rep(1,10),rep(2,10)) # "panel" matrix

xyplot(y~x|p) # does not work; can this be fixed (without the use of a 
dataframe)?
______________________________________________
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