nstring {neatR} | R Documentation |
neat representation of string
Description
neat representation of string
Usage
nstring(
string,
case = NULL,
remove.specials = FALSE,
whitelist.specials = "",
en.only = FALSE
)
Arguments
string |
a string / character |
case |
an optional parameter to convert the string variable to specific case. By default the case of the string is kept as it is. The available case conversions are lower, upper, title, start and initcap case. |
remove.specials |
an optional boolean. To remove special characters including any punctuation to be removed from the string, set this to TRUE. |
whitelist.specials |
an optional vector of strings. If any special characters to be retained while remove.specials is set to TRUE. See examples below. |
en.only |
an optional parameter taking boolean values, if set to TRUE, only english alphabets (and numbers) are kept in the string. Non english characters are removed. |
Value
White space cleaned and optionally formatted by case conversion and removal of special characters of the input string.
See Also
Refer to https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage for more information about the different cases of text/string.
Examples
nstring(' All MOdels are wrong. some ARE useful!!! ', case = 'title', remove.specials = TRUE)
nstring("all Models are Wrong some are Useful", case = 'start', remove.specials = TRUE)
nstring('variable_123!!', remove.specials = TRUE, whitelist.specials = c('_'))