[R] Lattice barplot not wokring in for-loop?

stvienna wiener stvienna at gmail.com
Fri Sep 18 11:44:21 CEST 2009


Dear List-Members,


I am plotting a barplot with the lattice package. The code works, but
when I execute the same code in a for-loop
no plot is shown. Can't figure what the problem is.
(Maybe I am missing something here, but I tried it with plot device
pdf, calling windows() or X11(), testing on windows and linux, etc.)

INFO: R version 2.9.1 (2009-06-26) using Windows/RGui

require(lattice)

for( z in 1:3) {

## plot works when executed alone,
## however in a for loop no plot is shown...
barchart(yield ~ variety | site, data = barley,
         groups = year, layout = c(1,6), stack = TRUE,
         auto.key = list(points = FALSE, rectangles = TRUE, space = "right"),
         ylab = "Barley Yield (bushels/acre)",
         scales = list(x = list(rot = 45)))

}



I can't program any further without solving this.

So, thanks! Really!
Steve




More information about the R-help mailing list