Thanks for your help. Maybe I was not clear in my question. Let say I have a R script , myscript.R which produce some file "mydata.Rdata" and saves them in /inst folder. My question is where to I put my script so that it will run when I build the package using "R CMD build" ? I want to include "mydata.RData" in my package and I want it to be updated every time i build the package.
I appreciate your help anyway. -Johan ----- Original Message ---- From: Adaikalavan Ramasamy <[EMAIL PROTECTED]> To: johan Faux <[EMAIL PROTECTED]> Cc: [email protected] Sent: Tuesday, March 20, 2007 12:10:21 PM Subject: Re: [R] run a script during R CMD build Yes, one way is to use commandArgs in the R script. So say your R script is as follows n <- as.character(commandArgs()[3]) fn <- as.character(commandArgs()[4]) mat <- matrix( rnorm( n*n ), nc=n ) write.table( mat, filenames=fn, sep="\t", quote=FALSE ) Then you execute the commands from command line as R --no-save < script 100 out.txt This will run the R commands and output them to "out.txt". johan Faux wrote: > I would like R CMD build to run some R code which does some stuff and save > the result as a file in /inst/docs folder. > Is there any way of doing this. > > Thank you. > Johan > > > > > > ____________________________________________________________________________________ > We won't tell. Get more on shows you hate to love > > > [[alternative HTML version deleted]] > > ______________________________________________ > [email protected] 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. > > > ____________________________________________________________________________________ Don't pick lemons. [[alternative HTML version deleted]] ______________________________________________ [email protected] 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.
