Dear list, I use the R CMD BATCH to run a file of R commands (from php for info) This file of R commands contains a line to source a configuration file "source('path/conf.R')" In this configuration file I define some variables, e.g. the path of some file (uploaded before this R CMD using php) "PathUpload <- 'path/uploads'" What I would like to achieve is to make this "PathUpload" relative to were R is at the time I launch it using the R CMD BATCH command so I would end up with something like "PathUpload <- './uploads'" (as in php in this example) I could not find anything in help or previous posts...any feedback on feasibility appreciated Thanks & regards, Julien _________________________________________________________________ [[elided Hotmail spam]] [[alternative HTML version deleted]]
Dear list, I use the R CMD BATCH to run a file of R commands (from php for info) This file of R commands contains a line to source a configuration file "source('path/conf.R')" In this configuration file I define some variables, e.g. the path of some file (uploaded before this R CMD using php) "PathUpload <- 'path/uploads'" What I would like to achieve is to make this "PathUpload" relative to were R is at the time I launch it using the R CMD BATCH command so I would end up with something like "PathUpload <- './uploads'" (as in php in this example) I could not find anything in help or previous posts...any feedback on feasibility appreciated Thanks & regards, Julien ¿Quieres conocerte mejor? ¡Conoce lo que Windows Live tiene especialmente para ti! _________________________________________________________________ [[alternative HTML version deleted]]
Maybe if you could send that path via the arguments, you could get them back using commandArgs(). Then you can setwd() and paste() to generate paths. julien cuisinier wrote:> > > Dear list, > > > > > > > > I use the R CMD BATCH to run a file of R commands (from php for info) > > This file of R commands contains a line to source a configuration file > "source('path/conf.R')" > > In this configuration file I define some variables, e.g. the path of some > file (uploaded before this R CMD using php) "PathUpload <- 'path/uploads'" > > > > What I would like to achieve is to make this "PathUpload" relative to were > R is at the time I launch it using the R CMD BATCH command > > > > so I would end up with something like "PathUpload <- './uploads'" (as in > php in this example) > > > > > > I could not find anything in help or previous posts...any feedback on > feasibility appreciated > > > > > > Thanks & regards, > > Julien > > _________________________________________________________________ > [[elided Hotmail spam]] > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org 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. > >-- View this message in context: http://www.nabble.com/Relative-paths-in-R--tp24737084p24739007.html Sent from the R help mailing list archive at Nabble.com.