R/fixtext.R

Defines functions fixtext

Documented in fixtext

#' standardize text within columns of a dataframe
#'
#' @param df dataframe whose column text you want to standardize
#' @export
fixtext <- function(df, colnames){
  for (i in 1:length(colnames)){
    x <- df[, colname[i]]
    x = trimws(x)
    x = str_replace_all(x, "[[:punct:]]", " ")
    x = sttt(x)
    df[, colname[i]] <- x
  }
  df
}
johnfrye/fryeR documentation built on Dec. 28, 2021, 6:20 p.m.