do_if: A pipable if statement

Description Usage Arguments Examples

View source: R/analysis.R

Description

This function allows to create an if statement that can be used within a pipable workflow

Usage

1
do_if(.data, condition, call)

Arguments

.data

tibble

condition

logical test

call

a formula descibing a pipe to be evaluated if condition is code

Examples

1
2
3
4
5
6
7
8
any_condition <- TRUE

mtcars %>%
do_if(any_condition, ~{
.x %>%
 dplyr::filter(cyl == 6) %>%
 dplyr::mutate(x = disp > 170)
})

openmindplatform/openmindR documentation built on Nov. 13, 2021, 2:13 p.m.