R/str_tidy.R

Defines functions str_tidy

Documented in str_tidy

#' Converts strings to a tidy format
#' 
#' @param x Input string
#' 
#' @author Shona Wilde
#' 
#' @return Cleaned string
#' 
#' @export

str_tidy <- function(x) {
  
  x_clean <- x %>% 
    str_to_lower() %>% 
    str_replace_all("-", "_") %>% 
    str_replace_all(" ", "_") %>% 
    str_replace_all(",", "_") 
  
  return(x_clean)
  
}
shonawilde/shonarrr documentation built on Jan. 29, 2025, 1:27 a.m.