Very weird behavior using levelplot inside a function:
> foo <- function() { require(lattice); levelplot(matrix(rnorm(100),10,10)) }
> bar <- function() { require(lattice); levelplot(matrix(rnorm(100),10,10)); return(1) }
> foo() ## graph gets generated
Loading required package: lattice
> graphics.off()
> bar() ## NO GRAPH GETS GENERATED
[1] 1
foo() works as expected, and bar() does not generate any plot. Any ideas?