Hi all, I am an R newbie, and I have a question about scripting. I have the following lines which I want to put int\ o a script which I can call from the shell of a Mac/Linux machine :
myrns <- read.csv(file="/Users/vihan/test.csv",sep="",header=FALSE) qqnorm(myrns) qqline(myrns) This works fine on an interactive R session. However, as I understand the basic framework of an R script for executing on the shell to get a pdf output it is something like : #!/usr/bin/Rscript … list inputs… pdf("plotexample.pdf", width=7, height=9) plot(...) dev.off() print(paste("Plot was saved in:", getwd())) therefore, I do : #!/usr/bin/Rscript myrns <- read.csv(file="/Users/vihan/test.csv",sep="",header=FALSE) qqnorm(myrns) dev.off() print(paste("Plot was saved in:", getwd())) but it does not work, the pdf generated is something my pdf viewer cannot understand, plot(qqnorm(myrns)) and plot(qqline(myrns)) don't work either. Any ideas on what I'm doing wrong? Moreover, would it be possible to have both qqline(myrns) and qqnorm(myrns) on the same pdf? Cheers! - vihan ______________________________________________ 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.