Auxiliary functions to perform some common data wrangling operations in an errors-aware fashion, i.e., to preserve uncertainty metadata.
Usage
gather_errors(.data, key, value, ...)
unite_errors(.data, suffix = ".se")
separate_errors(.data, suffix = ".se")
Arguments
- .data
a data frame.
- key, value
names of the new key and value columns, as strings.
- ...
a selection of columns to gather.
- suffix
suffix for the error column(s).
Details
gather_errors
is the errors-aware equivalent to
tidyr::gather
.
unite_errors
and separate_errors
are similar to
tidyr::unite
and tidyr::separate
, but only for errors
objects. For example, for each variable var
of class errors
,
separate_errors
will store the numeric value in var
and will
create another variable called var.se
for the errors. Similarly, for
each pair of variables var
and var.se
, unite_errors
will
store an errors
object in var
and will remove var.se
.
Note that the suffix .se
can be changed.