Learn R Programming

manymodelr (version 0.3.2)

fit_model: Fit and predict in a single function.

Description

Fit and predict in a single function.

Usage

fit_model(df = NULL, yname = NULL, xname = NULL, modeltype = NULL, ...)

Arguments

df

A data.frame object

yname

The outcome variable

xname

The predictor variable(s)

modeltype

A character specifying the model type e.g lm for linear model

...

Other arguments to specific model types.

Examples

Run this code
# NOT RUN {
fit_model(iris,"Sepal.Length","Species","lm")
fit_model(iris,"Sepal.Width","Sepal.Length + Petal.Length + I(Petal.Width)**2","lm")
# }

Run the code above in your browser using DataLab