Hi,
i need to get functions name from R file
example
test.R file having 2 functions like
add<-function()
{
a+b
}
sub<-function()
{
a-b
}
how to get function name from test.R file
i need output is functions are add,sub.
Thanks
B.Purushothaman
--
View this message in context: http://r.789695.n4.nabble.com/I-need-to-get-function-name-from-R-file-tp4636136.html
Sent from the R help mailing list archive at Nabble.com.
I need to get function name from R file
3 messages · Eik Vettorazzi, purushothaman
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:
Hi,
i need to get functions name from R file
example
test.R file having 2 functions like
add<-function()
{
a+b
}
sub<-function()
{
a-b
}
how to get function name from test.R file
i need output is functions are add,sub.
Thanks
B.Purushothaman
--
View this message in context: http://r.789695.n4.nabble.com/I-need-to-get-function-name-from-R-file-tp4636136.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________ R-help at r-project.org 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.
Eik Vettorazzi Department of Medical Biometry and Epidemiology University Medical Center Hamburg-Eppendorf Martinistr. 52 20246 Hamburg T ++49/40/7410-58243 F ++49/40/7410-57790 -- Pflichtangaben gem?? Gesetz ?ber elektronische Handelsregister und Genossenschaftsregister sowie das Unternehmensregister (EHUG): Universit?tsklinikum Hamburg-Eppendorf; K?rperschaft des ?ffentlichen Rechts; Gerichtsstand: Hamburg Vorstandsmitglieder: Prof. Dr. Guido Sauter (Vertreter des Vorsitzenden), Dr. Alexander Kirstein, Joachim Pr?l?, Prof. Dr. Dr. Uwe Koch-Gromus
it's working Thank You so much B.purushothaman -- View this message in context: http://r.789695.n4.nabble.com/I-need-to-get-function-name-from-R-file-tp4636136p4636284.html Sent from the R help mailing list archive at Nabble.com.