Re: [R] Problem with plotting data from within a function

2009-02-05 Thread Peter Dalgaard
Marie Sivertsen wrote: > 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) >>xypl

[R] Problem with plotting data from within a function

2009-02-05 Thread Marie Sivertsen
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