R/timed_fn.R

Defines functions timed_fn

Documented in timed_fn

#' Create file name with time stamp
#' 
#' This function generates a character string that suffixes a file name with a time stamp.
#' @param main The main file name to be used. 
#' @param extension The file extension to be used, e.g. ".csv"
#' @import stringr
#' @examples
#' timed_fn("Q15. ",".xlsx")
#' @export
timed_fn <- function(main,extension){
  Sys.time() %>%
    stringr::str_replace_all("[[:punct:]]","") %>%
    stringr::str_replace_all(" ","_") -> xtime
  
  paste(main,xtime,extension)
}
martinctc/surveytools documentation built on Nov. 21, 2024, 10:48 p.m.