Is it possible to generate PDFs/PNGs of graphs directly from the command line using R?
I attempted this with the command:
Rscript -e 'pdf(\'Graph.pdf\');plot(c(1,2,3,4,5));dev.off()'
which executes, but no file is generated.
Is it possible to generate PDFs/PNGs of graphs directly from the command line using R?
I attempted this with the command:
Rscript -e 'pdf(\'Graph.pdf\');plot(c(1,2,3,4,5));dev.off()'
which executes, but no file is generated.
Works here:
edd@max:~$ mkdir /tmp/demo
edd@max:~$ cd /tmp/demo
edd@max:/tmp/demo$ Rscript -e 'pdf("foo.pdf"); \
plot(cumsum(rnorm(100)), type="l"); \
dev.off()'
null device
1
edd@max:/tmp/demo$ ls -l
total 8
-rw-rw-r-- 1 edd edd 5132 Sep 12 19:36 foo.pdf
edd@max:/tmp/demo$
The chart (converted to png for inclusion here) is below.