[R] Re lative paths in R?
Glen Sargeant
gsargeant at usgs.gov
Thu Jul 30 18:50:06 CEST 2009
See also file.path() and create.dir(). You can use them with getwd() and
setwd() to specify and/or create subdirectories, relative to your current
working directory. Handy because they allow you to create paths and
directories with names derived within functions.
For example, I have used them to create output directories that reflect
dates when successive data summaries were prepared.
> #Current working directory is "c:\temp"
> #Creates a subdirectory, "data," relative
> #to current working directory
> wd <- getwd()
> sub <- file.path(wd,"data")
> dir.create(sub)
> #Changes working directory
> setwd(sub)
> getwd()
[1] "C:/temp/data"
> #Changes back
> setwd(wd)
> getwd()
[1] "C:/temp"
julien cuisinier wrote:
>
>
>
>
>
> Dear list,
>
>
>
> 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)
>
>
> ________________________________________________________________
>
>
> [[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--tp24738390p24742361.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list