Save with time stamp

Oftenly I have to deal with modifications of a scraping code, whose outcomes change or are subject to errors. Hence, I found useful to have a way to create versions of a data frame, this is a made savts.

This simple yet useful function creates csv file with time stamp. It saves a data frame in the working directory as a csv file, separated by semicolon with a date and system time (format %d%m%y_%H%M).

savts = function(x) {
  write.csv2(x, paste(getwd(), "/", deparse(substitute(x)), "-", format(Sys.time(),
    "%d%m%y_%H%M"), ".csv", sep = ""), row.names = FALSE)
}
Obryan Poyser Calderón
Obryan Poyser Calderón
Senior Data Scientist

My area of expertise include Time Series Forecast and Inference, Machine Learning and Econometrics.