R/string_cleaners.R

Defines functions clean_string

clean_string <- function(v){
  # tidy up titles with html tags
  v <- gsub('\\\n|\\\t|\\\r', '', v)
  # remove trailing / leading white space
  v <- gsub('^\\s+|\\s+$', '', v)
  # remove multiple white space with single space
  v <- gsub(' {2,}', ' ', v)
  # return 
  return(v)
}

Try the htmldf package in your browser

Any scripts or data that you put into this service are public.

htmldf documentation built on July 9, 2022, 5:06 p.m.