check_design_rule: Internal helper to test the design rules for any string and...

View source: R/check_design_rule.R

check_design_ruleR Documentation

Internal helper to test the design rules for any string and setting of to_any_case()

Description

Internal helper to test the design rules for any string and setting of to_any_case()

Usage

check_design_rule(string, sep_in = NULL, transliterations = NULL,
  sep_out = NULL, prefix = "", postfix = "", unique_sep = NULL,
  empty_fill = NULL, parsing_option = 1)

Arguments

string

A string (for example names of a data frame).

sep_in

String that will be wrapped internally into stringr::regex(). All matches will be treated as additional splitting parameters besides the default ones ("_" and " "), when parsing the input string.

transliterations

A character vector (if not NULL). The entries of this argument need to be elements of stringi::stri_trans_list() (like "Latin-ASCII", which is often useful) or names of lookup tables (currently only "german" is supported). In the order of the entries the letters of the input string will be transliterated via stringi::stri_trans_general() or replaced via the matches of the lookup table.

sep_out

String that will be used as separator. The defaults are "_" and "", regarding the specified case.

prefix

prefix (string).

postfix

postfix (string).

unique_sep

A string. If it is supplied, then duplicated names will get a suffix integer in the order of their appearance. The suffix is separated by the supplied string to this argument.

empty_fill

A string. If it is supplied, then each entry that matches "" will be replaced by the supplied string to this argument.

parsing_option

An integer that will determine the parsing_option.

  • 1: RRRStudio -> RRR_Studio

  • 2: RRRStudio -> RRRS_tudio

  • 3: parses at the beginning like option 1 and the rest like option 2.

  • 4: parses at the beginning like option 2 and the rest like option 1.

  • 5: parses like option 1 but suppresses "_" around non special characters. In this way case conversion won't apply after these characters. See examples.

  • 6: parses like option 1, but digits directly behind/in front non-digits, will stay as is.

  • any other integer <= 0: no parsing"

Value

A character vector separated by underscores, containing the parsed string.

Author(s)

Malte Grosser, malte.grosser@gmail.com


snakecase documentation built on Aug. 28, 2023, 1:07 a.m.