[R] Why doesnot Rscript work ?

Romain Francois romain.francois at dbmail.com
Mon Dec 14 11:15:01 CET 2009


Hi,

Rscript is meant for non-interactive use, so the default device is not 
the same as when you run R.

If you really want a window, open it yourself by calling the appropriate 
function (X11, windows, ... ) or reset the "device" option to whichever 
device you want to use, but it will disappear at the end of the script, 
so not very interesting.

You probably should open a png device or something and then write the 
grap there.

See ?png, ?pdf, ?X11, ?options, ?Rscript

Romain

On 12/14/2009 10:59 AM, z_axis wrote:
> %cat stock.R
> #! /usr/local/bin/Rscript
>
> args<- commandArgs(TRUE)
> args
>
> x<- read.csv("000301.csv")
> matplot(x[,1],x[,-1],type="l")
> #q(save="no")
>
> %Rscript stock.R 000301.csv
> [1] "000301.csv"
> matplot doesnot draw anything(no drawing window).
>
> Howeve, in R, source works great!
>> source("stock.R")
>
> Sincerely!
>


-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/HlX9 : new package : bibtex
|- http://tr.im/Gq7i : ohloh
`- http://tr.im/FtUu : new package : highlight




More information about the R-help mailing list