Takes a character variable containing units of measurement for a variable.
If it has zero length, a "" string is return. Otherwise, any trailing "s" is
removed if the string is longer than one character, and depending on the arguments,
the string is changed to lower case, "s" is added, and the first character is
changed to upper case.
Usage
Punits(u, lower = TRUE, adds = TRUE, upfirst = FALSE, default = "")
Arguments
- u
a single string containing units of measurement
- lower
if TRUE set string to all lower case
- adds
if TRUE add trailing "s"
- upfirst
if TRUE set first character to upper case
- default
default units if u is empty
Value
a single character string
Examples
if (FALSE) { # \dontrun{
Punits('Years')
} # }