View source: R/coalesce_with_checks.R
coalesce_with_checks | R Documentation |
Collapse multiple columns with redundant information into a single column. This function is similar to dplyr::coalesce, but uses several checks and informative error messages. Specifically, it checks for more than one unique non-NA value in each row, and returns an error if there are any such rows (in similar cases, dplyr::coalesce uses the first non-NA value). It then takes, for each row, the unique non-NA value found in one or more of the input columns, and places that value into the first column.
coalesce_with_checks(x, columns, tol = .Machine$double.eps^0.5)
x |
data frame containing the redundant columns to be coalesced/collapsed |
columns |
character vector, the names of the columns to be coalesced/collapsed. The values will be combined into the first column listed in |
tol |
numeric, the tolerance for assuming identity of floating-point numeric values. Defaults to the square route of the machine tolerance |
A data frame with columns
values collapsed into the first column listed.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.