Skip to content
Prev 72422 / 398498 Next

Counterpart for Matlab's 'feval'?

maybe you want something like this:

f <- function(x, FUN, ...){
    FUN <- match.fun(FUN)
    FUN(x, ...)
}

f(seq(-3, 3, 0.5), dnorm, sd = 1.1)
f(seq(-3, 3, 0.5), "pnorm", sd = 1.1)


but also take a look at ?optimize(), which will probably take you out 
of the trouble of writing a new function yourself.


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/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.be/biostat/
     http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Fredrik Thuring" <frt at Codan.dk>
To: <r-help at stat.math.ethz.ch>
Sent: Friday, June 24, 2005 11:14 AM
Subject: [R] Counterpart for Matlab's 'feval'?