Evalf: Evaluates a function like predicts evaluates a model

Description Usage Arguments Value Author(s) Examples

View source: R/Evalf.R

Description

Evaluates a function like predict evaluates a model

Usage

1
Evalf(fun, data = newdata, newdata)

Arguments

fun

A function, taking arguments as in a given row of data

data

A data frame

newdata

Not presently used

Value

Retuns a list of the function evaluations for each row of data

Author(s)

Georges Monette

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
##---- 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
  }

p3d documentation built on May 2, 2019, 5:25 p.m.