simplewords: Remove special characters and numbers and format to UTF-8...

View source: R/format.R

simplewordsR Documentation

Remove special characters and numbers and format to UTF-8 encoding with standardised capitalisation

Description

Takes a vector with character elements, removes special characters and numbers and formats them to UTF-8 encoding to make these consistent and compatible with most R analysis procedures. Returns strings with the first letter capitalised and the rest in lower case

Usage

simplewords(x, case, encode = TRUE)

Arguments

x

string or character vector

case

Optional; case of words to return; upper, lower or title (first letter upper case and the rest lower case). Default is title

encode

Optional; Logical; attempt to encode as UTF-8. Default is TRUE.

Value

Returns the input in UTF-8 format with special characters replaced with spaces and numbers removed.

Author(s)

Diane Hatziioanou

Examples

# strings <- simplewords(strings)
# clean_name <- simplewords("Latin-multi^name with strange/characters")
# df$Name <- simplewords(df$Name, case = "lower")



DHatziioanou/simpleepi documentation built on Sept. 24, 2024, 5:25 a.m.