The modelr package provides functions that help you create elegant
pipelines when modelling. It was designed primarily to support teaching
the basics of modelling for the 1st edition of R for Data
Science.
We no longer recommend it and instead suggest
https://www.tidymodels.org/ for a more comprehensive framework for
modelling within the tidyverse.
Installation
# The easiest way to get modelr is to install the whole tidyverse:
install.packages("tidyverse")
# Alternatively, install just modelr:
install.packages("modelr")
Getting started
library(modelr)
Partitioning and sampling
The resample class stores a “reference” to the original dataset and a
vector of row indices. A resample can be turned into a dataframe by
calling as.data.frame(). The indices can be extracted using
as.integer():
modelr
Overview
The modelr package provides functions that help you create elegant pipelines when modelling. It was designed primarily to support teaching the basics of modelling for the 1st edition of R for Data Science.
We no longer recommend it and instead suggest https://www.tidymodels.org/ for a more comprehensive framework for modelling within the tidyverse.
Installation
Getting started
Partitioning and sampling
The
resampleclass stores a “reference” to the original dataset and a vector of row indices. A resample can be turned into a dataframe by callingas.data.frame(). The indices can be extracted usingas.integer():The class can be utilized in generating an exclusive partitioning of a data frame:
modelr offers several resampling methods that result in a list of
resampleobjects (organized in a data frame):Model quality metrics
modelr includes several often-used model quality metrics:
Interacting with models
A set of functions let you seamlessly add predictions and residuals as additional columns to an existing data frame:
For visualization purposes it is often useful to use an evenly spaced grid of points from the data: