prefix_strip: prefix_strip

Description Usage Arguments Details Value Author(s) Examples

View source: R/utility_functions.r

Description

Strip a series of characters from the beginning of a character vector.

Usage

1
prefix_strip(var_string, prefixes, toTitle = TRUE, ...)

Arguments

var_string

A character vector, usually variable names

prefixes

A character vector, usually variable prefixes

toTitle

Convert results to Title Case? Defaults to TRUE.

...

Other arguments to 'gsub'

Details

Takes a character vector (usually vector of variable names from a summarized or tidied model object), along with a vector of character terms (usually the prefix of a dummy or categorical variable added by R when creating model terms) and strips the latter away from the former. Useful for quickly cleaning variable names for a plot.

Value

A character vector with 'prefixes' terms stripped from the beginning of 'var_name' terms.

Author(s)

Kieran Healy

Examples

1
prefix_strip(iris$Species, c("set", "v"))

kjhealy/socviz documentation built on July 20, 2020, 7:36 a.m.