Evalf | R Documentation |
Evaluates a function like predict
evaluates a model
Evalf(fun, data = newdata, newdata)
fun |
A function, taking arguments as in a given row of |
data |
A data frame |
newdata |
Not presently used |
Retuns a list of the function evaluations for each row of data
Georges Monette
##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function( fun, data = newdata, newdata ) {
# this is meant to evaluate a function much like predict 'evaluates' a model
inds <- seq_along( rownames(data) )
ret <- rep(NA, length(inds))
for ( i in inds ) {
ret[i] <- do.call(fun,data[i,])
}
ret
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.