fct_sub: Transform levels of a factor with a regular expression

Description Usage Arguments Value

View source: R/factors.R

Description

Replace the factor levels with a regular expression. fct_replace replaces the factor levels using a regular

Usage

1
fct_sub(f, pattern, replacement, all = TRUE)

Arguments

f

A factor

pattern, replacement

Pattern and replacement regular expressions. See str_replace.

all

If TRUE, replace all occurences of pattern, otherwise replace only the first occurrence.

Value

A factor vector with the values of f and transformed levels.


jrnold/rubbish documentation built on May 20, 2019, 2:05 a.m.