Add marginal check to model check

mc_condition_on(
  x = NULL,
  color = NULL,
  row = NULL,
  col = NULL,
  scales = "fixed"
)

Arguments

x

A variable quoted by ggplot2::vars() and defining the conditional variable on x axis.

color

A variable quoted by ggplot2::vars() and defining the color aesthetic in model check.

row, col

A set of variables quoted by ggplot2::vars() and defining faceting groups on the rows or columns

scales

The setting of scales in ggplot2::facet_grid(). Default to be "fixed".

Examples

library(ggplot2)
library(dplyr)
#> 
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#> 
#>     filter, lag
#> The following objects are masked from ‘package:base’:
#> 
#>     intersect, setdiff, setequal, union

mcplot(mpg_model) +
  mc_condition_on(x = vars(disp))
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's fill values.


mcplot(mpg_model) +
  mc_condition_on(x = vars(disp), row = vars(vs), col = vars(am))
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's fill values.