Skip to contents

Applr is a small R package that makes it easy to visualize slices of higher-dimensional linear models and to present model equations clearly. It includes base R and ggplot2 helpers, plus an interactive 3D view for models with two predictors.

Details

Core capabilities:

  • 2D slices of multi-variable models in base graphics

  • ggplot2 layer for plotting model slices across facets

  • Interactive 3D scatter with fitted surface (two predictors)

  • Quick text/LaTeX equations from lm() objects

Main functions

Quick start

Fit a model, then see it in one call:


library(Applr)
model <- lm(mpg ~ qsec + am, data = mtcars)
autoplot(model)

Or build the plot yourself with a geom_slice() layer:


library(ggplot2)
model <- lm(hwy ~ displ * drv + cyl, data = mpg)
ggplot(mpg, aes(displ, hwy, color = drv)) +
  geom_point() +
  geom_slice(model, band = TRUE) +
  geom_slice_text() +
  geom_slice_subtitle()

See also

Author

Maintainer: James Beeson jamesbeeson01@gmail.com

Authors:

Other contributors: