Description Usage Arguments Value Examples
View source: R/remove_group_subsets.R
Remove groups of rows within a data.frame that are proper subsets of other defined groups, to limit group duplication
1 | remove_group_subsets(x, target = NULL, group, by, invert = FALSE)
|
x |
Focal data.frame containing one or more defined groups |
target |
Optional target data.frame containing one or more defined
groups. Defaults to |
group |
Name of the column within |
by |
Character vector giving the column(s) by which |
invert |
Logical indicating whether to invert the results, and thus retain groups that are subsets rather than removing them. |
The focal data.frame x
, excluding groups representing subsets of other
groups.
1 2 3 4 5 6 7 8 | x <- data.frame(
x1 = c("a", "a", "a", "b", "b", "a", "a", "b", "c", "c", "b"),
x2 = c("a", "a", "a", "b", "b", "a", "a", "b", "c", "c", "b"),
g = c("1", "1", "1", "2", "2", "3", "3", "4", "4", "5", "5"),
stringsAsFactors = FALSE
)
remove_group_subsets(x, group = "g", by = c("x1", "x2"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.