mosaicformula: Convert formulas into standard shapes

Description Usage Arguments Details Examples

Description

These functions convert formulas into standard shapes, including by incorporating a groups argument.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
mosaic_formula(
  formula,
  groups = NULL,
  envir = parent.frame(),
  max.slots = 3,
  groups.first = FALSE
)

mosaic_formula_q(
  formula,
  groups = NULL,
  max.slots = 3,
  groups.first = FALSE,
  ...
)

Arguments

formula

a formula

groups

a name used for grouping

envir

the environment in which the resulting formula may be evaluated. May also be NULL, a list, a data frame, or a pairlist.

max.slots

an integer specifying the maximum number of slots for the resulting formula. An error results from trying to create a formula that is too complex.

groups.first

a logical indicating whether groups should be inserted ahead of the condition (else after).

...

additional arguments (currently ignored)

Details

mosaic_formula_q uses nonstandard evaluation of groups that may be necessary for use within other functions. mosaic_formula is a wrapper around mosaic_formula_q and quotes groups before passing it along.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
mosaic_formula( ~ x | z )
mosaic_formula( ~ x, groups=g )
mosaic_formula( y ~ x, groups=g )
# this is probably not what you want for interactive use.
mosaic_formula_q( y ~ x, groups=g )
# but it is for programming
foo <- function(x, groups=NULL) {
    mosaic_formula_q(x, groups=groups, envir=parent.frame())
}
foo( y ~ x , groups = g)

Example output

x ~ z | quote(groups)
x ~ quote(groups)
y ~ x | quote(groups)
y ~ x | g
y ~ x | g

mosaicCore documentation built on Jan. 16, 2021, 5:32 p.m.