[R] Execute a list of R instructions from a file

Gabor Csardi csardi at rmki.kfki.hu
Sun Jan 22 23:13:37 CET 2006


source("file.txt")

or even:

source("http://my.server.com/my/r/commands")

Gabor

On Sun, Jan 22, 2006 at 11:02:05PM +0100, pau carre wrote:
> Hello, I want to do the following: First, generate an R code in a file
> from an external program, then send the name of the file to R using
> sockets, finally let R to open that file and to execute the R code.
> I just wanted to know if there is any function in R that reads a file
> an executes the R code inside it.
> 
> Something like:
> file.txt:
> state <- c("tas", "sa",  "qld", "nsw", "nsw", "nt",  "wa",  "wa", "qld", "vic")
> 
> R execution:
> >readAndExecute(file.txt)
> 
> Thanks
> Pau.

-- 
Csardi Gabor <csardi at rmki.kfki.hu>    MTA RMKI, ELTE TTK




More information about the R-help mailing list