Skip to content
Prev 22836 / 63421 Next

Retrieving function name

probably you're looking for:

f <- function(FUN, x){
    list(funName = deparse(substitute(FUN)), value = FUN(x))
}

f(mean, rnorm(10))
f(median, rnorm(10))


I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Tom McCallum" <tom.mccallum at levelelimited.com>
To: <r-devel at r-project.org>
Sent: Thursday, November 09, 2006 4:28 PM
Subject: [Rd] Retrieving function name
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm