Build a bit flag by checking for cases
bf_case(
x,
...,
exclusive = TRUE,
pos = NULL,
na.val = NULL,
description = NULL,
registry = NULL
)
data.frame(1)
the table that contains tests
defined in ...
.
any set of (mutually exclusive) statements that results in a
logical return value
logical(1)
whether the function should check
that the cases are mutually exclusive, or whether it would allow that cases
defined later in the sequence overwrite cases earlier in the sequence.
integerish(.)
the position(s) in the bitfield that
should be set.
character(1)
optional value that should be
used to substitute NA values in the input data.
character(.)
optional description that
should be used instead of the default function-specific description. This
description is used in the registry legend, so it should have as many
entries as there will be entries per the respective flag in the legend (two
for a binary flag, as many as there are cases for a cases flag and one for
count or numeric flags).
registry(1)
a bitfield registry that has
been defined with bf_registry
; if it's undefined, an empty
registry will be defined on-the-fly.
an object of class 'registry' with the additional flag defined here.
registry <- bf_case(x = tbl_bityield, exclusive = FALSE,
yield >= 11,
yield < 11 & yield > 9,
yield < 9 & commodity == "maize")