So, if those statements are inside a function, I have to make my  
function to have an 'echo' argument/functionality? eg.:

## begin test.R
test <- function(n){
   y <- rnorm(n)
   x <- rnorm(n)
   z <- sample(letters[1:4], n, rep=T)
   library(lattice)
   bitmap("tst.png")
   xyplot(y~x|z)
   dev.off()
}

test(100)
## end test.R

source("test.R", echo=T)

also fails in this case...

thanks a lot,

b


On Jun 15, 2007, at 8:53 PM, [EMAIL PROTECTED] wrote:

> On 6/15/07, Benilton Carvalho <[EMAIL PROTECTED]> wrote:
>> Hi everyone,
>>
>> it's been a while I've been trying to save a plot created via
>> lattice:::xyplot
>>
>> if I have a file tst.R with the following code:
>>
>> y <- rnorm(100)
>> x <- rnorm(100)
>> z <- sample(letters[1:4], 100, rep=T)
>> library(lattice)
>> bitmap("tst.png")
>> xyplot(y~x|z)
>> dev.off()
>>
>> and I source it, I get the tst.png file, which is a blank page.
>>
>> If I copy and paste instead, I get the correct plot.
>>
>> Any suggestion?
>
> Use
>
> source(..., echo = TRUE)
>
> -Deepayan

______________________________________________
R-help@stat.math.ethz.ch 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