powered by
These functions perform keying by selection of variables using corresponding scoped variant of select. Appropriate data frame is selected with scoped function first, and then it is assigned as keys.
key_by_all(.tbl, .funs = list(), ..., .add = FALSE, .exclude = FALSE)key_by_if(.tbl, .predicate, .funs = list(), ..., .add = FALSE, .exclude = FALSE)key_by_at(.tbl, .vars, .funs = list(), ..., .add = FALSE, .exclude = FALSE)
key_by_if(.tbl, .predicate, .funs = list(), ..., .add = FALSE, .exclude = FALSE)
key_by_at(.tbl, .vars, .funs = list(), ..., .add = FALSE, .exclude = FALSE)
Reference data frame .
Parameter for scoped functions.
Whether to add keys to (possibly) existing ones. If FALSE keys will be overridden.
FALSE
Whether to exclude key variables from .tbl.
.tbl
Not scoped key_by()
mtcars %>% key_by_all(.funs = toupper) mtcars %>% key_by_if(rlang::is_integerish, toupper) mtcars %>% key_by_at(c("vs", "am"), toupper)
Run the code above in your browser using DataLab