Build a bit flag from a numeric value
bf_numeric(
x,
source,
...,
pos = NULL,
na.val = NULL,
description = NULL,
registry = NULL
)
data.frame(1)
the table that contains
source
.
character(1)
the column in x
from
which to take the numeric value.
description
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.
The length of the bitfield depends on the floating point precision
of the numeric values returned with this function. This is given as a
sequence of 3 integers of the form [1.5.10]. The first position
encodes how many bit are used (0 or 1), the second position encodes how
many exponent bits are used and the third position encodes how many
mantissa fields are used. See .determineEncoding
for details.
bf_numeric(x = tbl_bityield, source = "yield")
#> width 32
#> flags 1 --------------------------------
#>
#> pos encoding type col
#> 1 1.8.23/127 numeric yield