Skip to content
Prev 299806 / 398503 Next

I need to get function name from R file

Hi,
how about this:

sandbox<-new.env()
sys.source("test.R",envir=sandbox)

#all objects defined in "test.r"
(tstf<-ls(env=sandbox))

#just the functions
tstf[sapply(tstf, function(n) exists(n, envir = sandbox, mode =
"function", inherits = FALSE))]

hth

Eik

Am 11.07.2012 15:22, schrieb purushothaman: