Wolfram Fischer
2003-Oct-09 10:40 UTC
[R] lattice/levelplot: panels with values can be empty
I tried: library(lattice) F0 <- c( 'A', 'A', 'B', 'B' ) F1 <- c( 1 , 1 , 1 , 2 ) F2 <- c( 8 , 9 , 8 , 9 ) VAL <- c( 20, 50, 10, 60 ) df <- data.frame( F0, F1, F2, VAL ) levelplot( VAL ~ F1 * F2 | F0, data=df ) I got an empty field for F0 == 'A' and a colored field for F0 == 'B'. I expected two colored fields. - What can I do? Thanks. Wolfram
Deepayan Sarkar
2003-Oct-09 19:32 UTC
[R] lattice/levelplot: panels with values can be empty
On Thursday 09 October 2003 05:40, Wolfram Fischer wrote:> I tried: > library(lattice) > > F0 <- c( 'A', 'A', 'B', 'B' ) > F1 <- c( 1 , 1 , 1 , 2 ) > F2 <- c( 8 , 9 , 8 , 9 ) > VAL <- c( 20, 50, 10, 60 ) > df <- data.frame( F0, F1, F2, VAL ) > > levelplot( VAL ~ F1 * F2 | F0, data=df ) > > I got an empty field for F0 == 'A' > and a colored field for F0 == 'B'. > I expected two colored fields. - What can I do?Hmm, this seems to be a bug triggered when some panel has only one unique x (or y) value. Can't think of a workaround, other than adding some dummy rows with VAL = NA, e.g. F0 <- c( 'A', 'A', 'B', 'B', 'A') F1 <- c( 1 , 1 , 1 , 2 , 2 ) F2 <- c( 8 , 9 , 8 , 9 , 8 ) VAL <- c( 20, 50, 10, 60, NA ) df <- data.frame( F0, F1, F2, VAL ) Deepayan