Re: [Rd] Retrieving function name

2006-11-09 Thread Peter Dalgaard
"Tom McCallum" <[EMAIL PROTECTED]> writes: > Hi, > > Does anyone know how I can retrieve a function name, for example > > If I have a function f as follows: > > f <- function( myfunc ) { > print( name_of(myfunc) ); > } > > I want to know what I should have as "name_of" such that I could

Re: [Rd] Retrieving function name

2006-11-09 Thread Dimitris Rizopoulos
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 o