Sorry, I did not read the question properly. I believe all your functions goes in mypkg/R and your data goes into mypkg/data subdirectory respectively but I am no expert in this area.
If you want to reflect your data from one folder to another, you can try using a symbolic or soft link in *nix systems ln -s /inst/mydata.Rdata /somewhere/mypkg/data . Not sure if it the symbolic link approach will work when you try to R CMD BUILD mypkg. You might be interested in the examples in package.skeleton(). Regards, Adai johan Faux wrote: > 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: r-help@stat.math.ethz.ch > 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]] >> >> ______________________________________________ >> R-help@stat.math.ethz.ch 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. > See all the new 2007 cars at Yahoo! Autos. > http://autos.yahoo.com/new_cars.html ______________________________________________ R-help@stat.math.ethz.ch 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.