Displaying 1 result from an estimated 1 matches for "reloaddir".
Did you mean:
readdir
2009 Aug 21
2
Lightweight 'package' idea.
...ns
* Don't see the functions in ls()
* After editing R, make it easy to update the definitions visible to
R (unlike rebuilding and reloading a package).
So I wrote these two in a few mins:
loadDir <- function(dir){
e = attach(NULL,name=dir)
assign("__path__",dir,envir=e)
reloadDir(e)
e
}
reloadDir <- function(e){
path = get("__path__",e)
files = list.files(path,".R$",full.names=TRUE,recursive=TRUE,ignore.case=TRUE)
for(f in files){
sys.source(f,envir=e)
}
}
Usage is something like:
lib1 = loadDir("/foo/bar/baz/lib1/")
- i...