standardize_names: Standardize a character vector to standard syntax...

View source: R/standardize_names.R

standardize_namesR Documentation

Standardize a character vector to standard syntax (deduplication copied from limma::makeUnique)

Description

Standardize all elements of a character vector to the same syntax. All letters are converted to lowercase, special characters are converted to underscores (snake_case) or removed (camelCase), and multiple and trailing (but not leading) special characters are removed. By default, elements are deduplicated by appending "_1" (snake_case) or "1" (camelCase) and so on.

Usage

standardize_names(x, dedup = TRUE, case = "snake_case")

Arguments

x

character vector with elements to be standardized

dedup

logical, whether to deduplicate the vector elements. If TRUE, elements that are identical after standardization are deduplicated by appending "_1", "_2", etc. Defaults to TRUE.

case

character, whether to standardize to "snake_case" or "camelCase" case. Defaults to "snake_case". Partial matches are okay.

Value

a character vector of the same length as x


mjdufort/miscHelpers documentation built on Feb. 4, 2024, 7:44 p.m.