Learn R Programming

psycho (version 0.4.91)

get_data: Extract the dataframe used in a model.

Description

Extract the dataframe used in a model.

Usage

get_data(fit, ...)

Arguments

fit

A model.

...

Arguments passed to or from other methods.

Examples

Run this code
# NOT RUN {
library(tidyverse)
library(psycho)

df <- mtcars %>%
  mutate(
    cyl = as.factor(cyl),
    gear = as.factor(gear)
  )

fit <- lm(wt ~ mpg, data = df)
fit <- lm(wt ~ cyl, data = df)
fit <- lm(wt ~ mpg * cyl, data = df)
fit <- lm(wt ~ cyl * gear, data = df)
fit <- lmerTest::lmer(wt ~ mpg * gear + (1 | cyl), data = df)
fit <- rstanarm::stan_lmer(wt ~ mpg * gear + (1 | cyl), data = df)

get_data(fit)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab