R/cleanText.R

Defines functions cleanText

#' @export cleanText
cleanText <- function(text) {
  text <- tolower(text)
  #   text[!text %in% c("__na__", "", " na ")] <- NA
  text <- gsub("[[:punct:][:digit:]]", " ", text)
  text <- gsub("\\\r", " ", text)
  text <- gsub("\\\n", " ", text)
  text <- gsub("[[:space:]]+", " ", text)
  return(text)
}
jon-mellon/mellonMisc documentation built on July 4, 2022, 9:51 a.m.