Dear List,

I try to develop code where plotting functions are embeded in my own
functions.  The following is simplified example:

> test <- function() {
>    data <- data.frame(x=rep(1:2, each=50), y=rnorm(100))
>   library(lattice)
>    attach(data)
>    xyplot(y~x)
>    detach()
>}
>test()


As far as I understand R, when test is called this should create one local
data frame, attach it that it's columns are available directly, load the
lattice library, plot data, and then detach the data frame.  But, when I
call test, nothing happens.  I see not plot and no error message.  When I
try the script from Rscript, nothing happens too.  But when I copy the
inside code from test and run it directly, all seems to work.  What am I
doing wrong?  Is this a question to be asked here, or to the developers of
lattice package?

Mvh.
Marie

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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