restore-keys-scoped | R Documentation |
These functions restore selection of keys using corresponding
scoped variant of select. .funs
argument can be used to rename some keys (without touching actual keys)
before restoring.
restore_keys_all(.tbl, .funs = list(), ..., .remove = FALSE,
.unkey = FALSE)
restore_keys_if(.tbl, .predicate, .funs = list(), ..., .remove = FALSE,
.unkey = FALSE)
restore_keys_at(.tbl, .vars, .funs = list(), ..., .remove = FALSE,
.unkey = FALSE)
.tbl |
Reference data frame. |
.funs |
Parameter for scoped functions. |
... |
Parameter for scoped functions. |
.remove |
Whether to remove keys after restoring. |
.unkey |
Whether to |
.predicate |
Parameter for scoped functions. |
.vars |
Parameter for scoped functions. |
df <- mtcars %>% dplyr::as_tibble() %>% key_by(vs, am, disp)
# Just restore all keys
df %>% restore_keys_all()
# Restore all keys with renaming and without touching actual keys
df %>% restore_keys_all(.funs = toupper)
# Restore with renaming and removing
df %>%
restore_keys_all(.funs = toupper, .remove = TRUE)
# Restore with renaming, removing and unkeying
df %>%
restore_keys_all(.funs = toupper, .remove = TRUE, .unkey = TRUE)
# Restore with renaming keys satisfying the predicate
df %>%
restore_keys_if(rlang::is_integerish, .funs = toupper)
# Restore with renaming specified keys
df %>%
restore_keys_at(c("vs", "disp"), .funs = toupper)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.