standardize_dimnames: Standardize the column and/or row names of a matrix or data...

View source: R/standardize_dimnames.R

standardize_dimnamesR Documentation

Standardize the column and/or row names of a matrix or data frame to standard syntax, defaulting to snake_case

Description

Standardize column and/or row names of a matrix or data frame to a standard syntax. This is a wrapper for standardize_names, to allow it to be used on data frames and matrices, rather than on their names. 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_dimnames(
  x, cols = TRUE, rows = FALSE, dedup = TRUE, case = "snake_case")

Arguments

x

data frame or matrix with column and/or row names to be standardized

cols, rows

logical, whether to standardize the column and row names, respectively. By default, column names are standardized, but row names are not.

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, specifying whether to convert to snake_case or camelCase. Abbreviations are accepted. Defaults to snake_case.

Value

an object of the same type and dimension as x


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