Hi all - I'm trying to generate lattice barchart graphs with missing  
values, and came across the following:

This does not run.  I would expect it to:

library(lattice)
D = data.frame(X=1, Y=factor(letters[2], letters[1:2]))
barchart(~ X, D, groups=Y)

Error in grid.Call.graphics("L_rect", x$x, x$y, x$width, x$height,  
resolveHJust(x$just,  :
        invalid line type

which is simply solved by changing the factor levels:

D$Y = factor(D$Y)
barchart(~ X, D, groups=Y)

or by filling factor levels from the bottom:

D = data.frame(X=1, Y=factor(letters[1], letters[1:2]))
barchart(~ X, D, groups=Y)

However, the failure is important, because it causes the following to  
fail, no matter how Y is levelled

E = data.frame(X=c(1,2,3,4), Y=factor(letters[c(1,2,1,2)], letters 
[1:2]), Z=factor(c("F","F","G","H")));
barchart(~ X | Z, E, groups=Y)

Which is an example of a comparison over multiple tests Z for  
different parameter Y where some Y are missing.

alternative version:

E = data.frame(X=c(1,2,3,4), Y=letters[c(1,2,1,2)], Z=letters[c 
(7,7,8,9)]);
barchart(~ X | Z, E, groups=Y)

I have updated to 2.4.0 and lattice 0.14-16 and the problem still  
exists.

-Alex Brown

______________________________________________
[email protected] 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