r - What is the equivalent of facet_wrap in Lattice -


say have data this:

dta <- data.frame(    group = rep(letters[1:8], each=1000),     x = runif(8000), y=runif(8000) ) 

i produce lattice plot containing y ~ x each group. but, groups a-d on first row, , e-h on second row. i.e., equivalent of

 qplot(x=x, y=y, data=dta) + facet_wrap(~ group, nrow=2) 

but in lattice. best way this?

library(lattice) xyplot(y ~ x | group, dta, layout=c(4,2), as.table = true) 

as suggested @benbarnes, as.table = true keeps order of facets.

enter image description here


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -