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

View source: R/labels.R

trim_prefixR Documentation

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)

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.

Value

The trimmed character or factor vector.


volker documentation built on April 12, 2025, 9:16 a.m.