A collection of utility functions that facilitate looking up vector values from a lookup table, annotate values in a table for clearer viewing, and support a safer approach to vector sampling, sequence generation, and aggregation. Also included is a family of argument checks which return their input so that they compose nicely in a pipe.
You can install the released version of zmisc from CRAN with:
You can use pak to install the development version of
zmisc from GitHub with:
The functions lookup()
and lookuper()
are used to look up values from a lookup table, which can be supplied as
a vector, a list, or a
data.frame. The functions are in some ways similar to the
Excel function VLOOKUP(), but are designed to work smoothly
in an R workflow, in particular within pipes.
Gets or sets the variable label (label attribute) of a
labelled vector. The getters/setters should be used rather than
manipulating attributes directly, since these functions perform checks
to ensure that the result, and the resulting labelled variable, are
valid.
The functions zample(), zeq(), and zingle() are intended to make your code less likely to break in mysterious ways when you encounter unexpected boundary conditions. The zample() and zeq() are almost identical to the sample() and seq() functions, but a bit safer.
The chk_*() functions check the type and shape of an
argument and, on failure, raise an rlang-style error naming the argument
as the caller wrote it. Each returns its input, so a check composes in a
pipe. See vignette("chk") for the full set.