[R] I need to get function name from R file
Eik Vettorazzi
E.Vettorazzi at uke.de
Wed Jul 11 17:13:27 CEST 2012
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
More information about the R-help
mailing list