given: given

givenR Documentation

given

Description

Simple function that filters a vector while helping with missing values. Replacing expression like 'x[x > 3 & !is.null(x)]'

Usage

given(.x, .y, ignore_na = FALSE)

given_(.x, .y, ignore_na = TRUE)

Arguments

.x

the vector to filter

.y

a logical vector to filter with

ignore_na

should NA be removed?

Value

a vector

Examples

## Not run: 
x <- c(1, 2, NA, 4)
x %>% given_(x >= 2)

## End(Not run)


davidsjoberg/hablar documentation built on March 13, 2023, 1:26 a.m.