combine_data_across_cols {kim} | R Documentation |
Combine data across columns
Description
Combine data across columns. If NA is the only value across all focal columns for given row(s), NA will be returned for those row(s).
Usage
combine_data_across_cols(data = NULL, cols = NULL)
Arguments
data |
a data object (a data frame or a data.table) |
cols |
a character vector containing names of columns, across which to combine data |
Value
the output will be a numeric or character vector.
Examples
dt <- data.frame(v1 = c(1, NA), v2 = c(NA, 2))
dt
combine_data_across_cols(data = dt, cols = c("v1", "v2"))
dt <- data.frame(v1 = c(1, 2, NA), v2 = c(NA, 4, 3))
dt
combine_data_across_cols(data = dt, cols = c("v1", "v2"))
dt <- data.frame(v1 = c(1, NA, NA), v2 = c(NA, 2, NA))
dt
combine_data_across_cols(data = dt, cols = c("v1", "v2"))
[Package kim version 0.5.422 Index]