first_three_args: Handle the first three arguments of graphics functions

View source: R/utilities.R

first_three_argsR Documentation

Handle the first three arguments of graphics functions

Description

This function is intended for package developers, not end-users. Canonically, mosaicCalc functions that produce layerable graphics have three initial arguments in a specific order: (1) a previous gg layer, (2) a tilde expression, and (3) a domain. But either (1) or (3) can be missing. first_three_args() translates a leading ... argument into the list of the canonical three initial arguments, returning them as components of a list. In addition, there may be additional arguments in ... that specify other aspects of the plot, e.g. color.

Usage

first_three_args(..., two_tildes = FALSE)

Arguments

...

unnamed arguments to be translated into a list with the three canonical arguments and any other arguments not named explicitly in the parent function definition.

two_tildes

if TRUE then look for the first FOUR arguments, the middle two of which will be tilde expressions.

Details

In constructing a mosaicCalc graphics layer, the function (e.g. slice_plot() or contour_plot()) whould have ... as its first argument. Intercept that ... with first_three_args() to extract the first three canonical arguments as components gg, tilde, and domain of a list. Any remaining arguments in ... will be placed in the dots component.


mosaicCalc documentation built on Sept. 15, 2022, 9:06 a.m.