get_matchvars: Returns list of variables matching matters

Description Usage Arguments Examples

Description

Searches through all variable names and returns all that match a search term, using regular expressions.

Usage

1

Arguments

d

The full data frame

pattern

The pattern to match in the variable name

Examples

1
2
3
4
# Get all variable names including "Q6_"
get_matchvars(survey, "Q6_")
# Create data frame with only Q6 variables
new_data <- survey[get_matchvars(survey, "Q6_")]

rblissett/pubpub documentation built on May 29, 2019, 6:53 p.m.