library(ggplot2)
library(dplyr)
# Ungrouped
mpg |> lm_test( cty ~ hwy * cyl)
# Grouped
mpg |> group_by(class) |> lm_test(cty ~ hwy * cyl)
# Nested
mpg |> nest_by(class) |> lm_test(cty ~ hwy * cyl)
Run the code above in your browser using DataLab