Re: [R] search path question

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

Yes, it is.
The original is here

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.

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:
Sent from the R help mailing list archive at

______________________________________________ mailing list
PLEASE do read the posting guide
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 Please read the posting guide before posting to the list.