View source: R/utils-dataframe.R
switch_pipeline | R Documentation |
dplyr
pipeline based on a set of conditionsBranch a dplyr
pipeline based on a set of conditions
switch_pipeline(.x, ...)
.x |
a dataframe |
... |
a list of formulae of the type |
the result of applying purrr function
to .x
in the case where
predicate
evaluates to true. Both predicate and function can refer to
the pipeline dataframe using .x
iris %>% switch_pipeline(
is_col_present(.x, Species) ~ .x %>% dplyr::rename(new = Species)
) %>% dplyr::glimpse()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.