[R] how to run a linux syntax within an R script?

Christian Salas christian.salas at yale.edu
Mon Nov 12 02:28:51 CET 2007


Is it possible to run a linux syntax (i.e. like i was at a linux 
terminal) from an R code?

Just one example:
Let say that I have an R code with

hist(rnorm(100))
dev.copy2eps(file="Dnormal.eps")

and then within the same R code, i want to convert the file 
'Dnormal.eps' to 'Dnormal.pdf'. This can be achieved using at the linux 
terminal
%epstopdf Dnormal.eps

but i do not know how to include this within the R script, any ideas?

I know that i can also save the plot (within R) using pdf(), but I want 
to save the same plot as eps and pdf, without having to reproduce the 
code for the plot (in this case the plot is easy, but not always is like 
that)

I want to do this to compile later a document using pdflatex (uses pdf 
figures) or latex (uses eps figures). Again, I know that i can also 
compile (in latex) the document to dvi, and then to ps, and then to pdf, 
with this i do not need pdf figures, but i prefer to use pdflatex sometimes.


Thanks for the help

christian

Ps; Operative system used: Linux (Ubuntu-linux 7.10)
  R operative system: linux-gnu
  R version: R version 2.5.1 (2007-06-27)



More information about the R-help mailing list