Learn R Programming

volker (version 3.0.0)

trim_prefix: Remove a prefix from a character vector or a factor

Description

If the resulting character values would be empty, the prefix is returned. At the end, all items in the vector are trimmed using trim_label.

Usage

trim_prefix(x, prefix = TRUE)

Value

The trimmed character or factor vector.

Arguments

x

A character or factor vector.

prefix

The prefix. Set to TRUE to first extract the prefix.

Details

If x is a factor, the order of factor levels is retained.