Description Usage Arguments Value Examples
Extract columns with similar names and output a list of separate data.frames for easy comparison.
The presence/absence of a prefix/suffix identifies similar colums,
and the default corresponds to default-data.table joining (e.g., i.count
, count
).
You can provide a list of column names for extraction instead.
1 2 3 4 5 6 7 8 |
x |
a data.frame. |
id_cols |
character vector of any ID columns to retain in each data.frame output. |
pattern |
a regular expression pattern to match the distinguishing prefix/suffix. |
col_list |
a list of |
restrict |
one of |
rm_allna |
logical indicating whether, in each set of comparison columns, all- |
A list of data.frame objects.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | set.seed(575)
x <- data.frame(id = paste0("row_", 1:10),
char = LETTERS[1:10],
i.char = sample(LETTERS[1:10]),
num = 1:10,
i.num = sample(1:10)
)
comp_cols(x)
comp_cols(x, id_cols = "id", restrict = "mismatch")
x[2, "char"] <- NA
x[2, "num"] <- NA
x[3, c("char", "i.char")] <- NA
x[5, c("num", "i.num")] <- NA
comp_cols(x)
comp_cols(x, id_cols = "id", rm_na = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.