[R] search path question
Vladimir Eremeev
wl2776 at gmail.com
Tue May 29 17:06:18 CEST 2007
Yes, it is.
The original is here
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/92829.html
However, it requires some modifications.
Here they are. Sorry, I can test it only in Windows.
search.source <- function(file, path=Sys.getenv("PATH"), ...)
{
for(p in strsplit(path,.Platform$path.sep)[[1]]) {
fp <- file.path(p, f)
if(file.exists(fp)) return(source(fp, ...))
}
stop("file ", sQuote(file), " not found")
}
Try also looking here.
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/92821.html
Zhiliang Ma wrote:
>
> Is there a simple function that can add a folder into current R search
> path?
> For example, suppose my current work directory is "D:\work", but my input
> files are stored in folder "C:\inFiles\", I know I can change work
> directory or add "C:\inFiles\" before files name when I scan them, but I
> don't want to do that. I want to find a function that can simply add
> "C:\inFiles\" into R's search path, so that we I scan a file R will go to
> all the search paths to find it. In matlab, path(path,"C:\inFiles") will
> do
> this job, I'm just wondering if there is a similar function in R can do
> this
> job.
>
--
View this message in context: http://www.nabble.com/search-path-question-tf3833821.html#a10855885
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list