predict.lookupTable: Predictions from a look-up table

Description Usage Arguments Value Examples

View source: R/lookupTable.R

Description

predict method for lookupTable objects

Usage

1
2
## S3 method for class 'lookupTable'
predict(object, newdata, newparams = NULL, ...)

Arguments

object

a fitted lookupTable object

newdata

data.frame from which to evaluate predictions

newparams

new parameters to use in evaluating predictions

...

optional additional parameters. None are used at present.

Value

a numeric vector of predicted values

Examples

1
2
3
4
5
6
7
df.input <- cars
response <- 'dist'
feature.boundaries <- list(c(-Inf, 5, 10, 15, 20, 25, Inf))
features.con <- c('speed')
dist.table <- lookupTable(df.input, response, feature.boundaries, features.con)
df.test <- data.frame(speed = c(2, 23, 41, 5, 9, 8))
predict(dist.table, df.test)

Example output

Loading required package: data.table
[1]  6.00000 82.85714 38.27395 18.57143 18.57143 18.57143

lookupTable documentation built on May 2, 2019, 2:57 p.m.