Learn R Programming

poorman (version 0.2.6)

where: Select variables with a function

Description

This selection helper selects the variables for which a function returns TRUE.

Usage

where(fn)

Value

A vector of integer column positions which are the result of the fn evaluation.

Arguments

fn

A function that returns TRUE or FALSE.

See Also

select_helpers

Examples

Run this code
iris %>% select(where(is.numeric))
iris %>% select(where(function(x) is.numeric(x)))
iris %>% select(where(function(x) is.numeric(x) && mean(x) > 3.5))

Run the code above in your browser using DataLab