Re: [R] search path question

From: Vladimir Eremeev <wl2776_at_gmail.com>
Date: Tue, 29 May 2007 08:06:18 -0700 (PDT)

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.

______________________________________________
R-help_at_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.
Received on Tue 29 May 2007 - 15:11:02 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 May 2007 - 16:31:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.