R/str.R

Defines functions unaccent

Documented in unaccent

# str
#
# String functions
#



## FUNCTIONS ----



# unaccent ----

#' Remove accents
#'
#' This function removes accents from character strings.
#'
#' @param string input character vector.
#' @return An unaccented character vector.
#' @examples
#' unaccent("Jérémie")
#' unaccent("Héloïse")
#' @export

unaccent <- function(string) {
  text <- gsub("['`^~\"]", " ", string)
  text <- iconv(text, to="ASCII//TRANSLIT//IGNORE")
  return(text)
}
pmerckle/datatools documentation built on Feb. 21, 2022, 2:19 a.m.