4242# ' @param show_residuals Logical, if `TRUE`, display residuals of the model
4343# ' as a background to the model-based estimation. Residuals will be computed
4444# ' for the predictors in the data grid, using [`residualize_over_grid()`].
45+ # ' @param collapse_group For mixed effects models, name of the grouping variable
46+ # ' of random effects. If `collapse_group = TRUE`, data points "collapsed" by the
47+ # ' first random effect groups are added to the plot. Else, if `collapse_group`
48+ # ' is a name of a group factor, data is collapsed by that specific random
49+ # ' effect. See [`collapse_by_group()`] for further details.
4550# ' @param point,line,pointrange,ribbon,facet,grid Additional
4651# ' aesthetics and parameters for the geoms (see customization example).
4752# ' @param ... Arguments passed from `plot()` to `visualisation_recipe()`, or
159164# ' plot(x)
160165# ' }
161166# ' @export
162- visualisation_recipe.estimate_predicted <- function (x ,
163- show_data = FALSE ,
164- show_residuals = FALSE ,
165- point = NULL ,
166- line = NULL ,
167- pointrange = NULL ,
168- ribbon = NULL ,
169- facet = NULL ,
170- grid = NULL ,
171- join_dots = NULL ,
172- numeric_as_discrete = NULL ,
173- ... ) {
167+ visualisation_recipe.estimate_predicted <- function (
168+ x ,
169+ show_data = FALSE ,
170+ show_residuals = FALSE ,
171+ collapse_group = NULL ,
172+ point = NULL ,
173+ line = NULL ,
174+ pointrange = NULL ,
175+ ribbon = NULL ,
176+ facet = NULL ,
177+ grid = NULL ,
178+ join_dots = NULL ,
179+ numeric_as_discrete = NULL ,
180+ ...
181+ ) {
174182 # Process argument ---------------------------------------------------------
175183 # --------------------------------------------------------------------------
176184
@@ -186,6 +194,7 @@ visualisation_recipe.estimate_predicted <- function(x,
186194 x ,
187195 show_data = show_data ,
188196 show_residuals = show_residuals ,
197+ collapse_by = collapse_group ,
189198 point = point ,
190199 line = line ,
191200 pointrange = pointrange ,
@@ -233,13 +242,15 @@ visualisation_recipe.estimate_means <- visualisation_recipe.estimate_predicted
233242# ' plot(visualisation_recipe(x))
234243# ' }
235244# ' @export
236- visualisation_recipe.estimate_slopes <- function (x ,
237- line = NULL ,
238- pointrange = NULL ,
239- ribbon = NULL ,
240- facet = NULL ,
241- grid = NULL ,
242- ... ) {
245+ visualisation_recipe.estimate_slopes <- function (
246+ x ,
247+ line = NULL ,
248+ pointrange = NULL ,
249+ ribbon = NULL ,
250+ facet = NULL ,
251+ grid = NULL ,
252+ ...
253+ ) {
243254 .visualization_recipe(
244255 x ,
245256 show_data = FALSE ,
@@ -285,13 +296,15 @@ visualisation_recipe.estimate_slopes <- function(x,
285296# ' plot(x)
286297# ' }
287298# ' @export
288- visualisation_recipe.estimate_grouplevel <- function (x ,
289- line = NULL ,
290- pointrange = NULL ,
291- ribbon = NULL ,
292- facet = NULL ,
293- grid = NULL ,
294- ... ) {
299+ visualisation_recipe.estimate_grouplevel <- function (
300+ x ,
301+ line = NULL ,
302+ pointrange = NULL ,
303+ ribbon = NULL ,
304+ facet = NULL ,
305+ grid = NULL ,
306+ ...
307+ ) {
295308 if (is.null(facet )) {
296309 facet <- list (scales = " free" )
297310 } else {
0 commit comments