To Proper

toproper(
  string,
  replace_underscores = TRUE,
  underscore_replacement = " ",
  return_as = c("titlecase", "uppercase", "lowercase", "asis"),
  uppers = c("Id", "Aop", "Cat", "Eq", "Tiv")
)

Arguments

string

string to manipulate on

replace_underscores

Logical: if TRUE replaces all underscores with specified underscore_replacement argument's value.

underscore_replacement

Character: if argument replace_underscores equals TRUE, will replace all "_"'s with specified string.

return_as

How should the string be returned? Options are:

  • "titlecase": Applies stringr::str_to_title.

  • "uppercase": Applies toupper.

  • "lowercase": Applied tolower.

  • "asis": No manipulation. Returns as is.

uppers

Character vector of any strings that should be displayed in upper-case (i.e. TPA, WC, AL, ABC, etc.)

Value

"Proper" string

See also

Examples

s <- "variable_a is awesome" toproper(s)
#> [1] "Variable A Is Awesome"