customPredict: Create a custom predict function

Description Usage Arguments Examples

View source: R/customPredict.R

Description

customPredict creates a custom predict function that transforms the output of usual predict.

Usage

1
2
3
4
5
6
customPredict(model, transform = identity, ...)

is_customPredict(x)

## S3 method for class 'customPredict'
predict(model, ...)

Arguments

model

a model (e.g. of class lm, glm, rpart etc.), that has associated predict function.

transform

a function used to transform output of predict(model, ...).

...

futher arguments passed to predict.

x

an customPredict-class object.

Examples

1
2
3
4
5
6
model1 <- lm(log(mpg) ~ 1, data = mtcars)
model1_cp <- customPredict(model1, transform = exp)

predict(model1)
exp(predict(model1))
predict(model1_cp)

twolodzko/twextras documentation built on May 3, 2019, 1:52 p.m.