The goal of this function is to allow the user a quick and easy glance at the experimental layout of a trial by creating multiple desplots at once - one for each variable that is provided (see example below).

desplot_across(
  data,
  vars,
  formright = "col + row",
  lang = c("eng", "ger")[1],
  title = c("none", "short", "long")[3],
  flip = TRUE,
  out1.gpar = list(col = "black", lwd = 1, lty = "dotted"),
  out2.gpar = list(col = "black", lwd = 1, lty = "dotted"),
  ...
)

Arguments

data

A data frame.

vars

<tidy-select> Variables/column names for which a desplot should be created. You can use tidyselect helpers like starts_with(), ends_with(), contains(), etc.

formright

A formula like x*y|location, i.e. the right-hand side of the formula yield~x*y|location that would usually be passed to desplot::desplot(form = ...). Note that x and y are numeric and the default is "col + row".

lang

Language for plots labels.

title

Can either be "none", "short" or "long". For the respective var, it gives information about the number of levels and their respective frequency in the data.

flip

see desplot::desplot() documentation - set to opinionated default here

out1.gpar

see desplot::desplot() documentation - set to opinionated default here

out2.gpar

see desplot::desplot() documentation - set to opinionated default here

...

Other arguments passed to desplot::desplot().

Value

A list of desplots.

Examples

library(BioMathR)

# Using explicit column names
dps <- desplot_across(data = agridat::yates.oats,
                      vars = c("nitro", "gen", "block"),
                      cex = 1)

# Using tidyselect helpers
dps2 <- desplot_across(data = agridat::yates.oats,
                       vars = starts_with("n"),
                       cex = 1)

dps$nitro

dps$gen

dps$block