metan (version 1.2.1)

Select_helper: Select helper

Description

These functions allow you to select variables based operations with prefixes and suffixes.

  • difference_var(): Select variables that start with a prefix AND NOT end wiht a suffix.

  • intersect_var(): Select variables that start with a prefix AND end wiht a suffix.

  • union_var(): Select variables that start with a prefix OR end wiht a suffix.

Usage

difference_var(prefix, suffix)

intersect_var(prefix, suffix)

union_var(prefix, suffix)

Arguments

prefix

A prefix that start the variable name.

suffix

A suffix that end the variable name.

Examples

Run this code
# NOT RUN {
library(metan)

# Select variables that start with "C" and not end with "D".
data_ge2 %>%
select(difference_var("C", "D"))

# Select variables that start with "C" and end with "D".
data_ge2 %>%
select(intersect_var("C", "D"))


# Select variables that start with "C" or end with "D".
data_ge2 %>%
select(union_var("C", "D"))

# }

Run the code above in your browser using DataLab