#' @name saveVersion
#' @title saveVersion - An offline version control function
#'
#' This function saves a dated, timestamped version of any R object in a subdirectory of your working directory named /Env/Versions. Retrieve the object using latest(). It's a good idea to periodically delete old saved versions that you no longer need.
#' @param s The variable for your R object.
#' @keywords version control
#' @import dplyr
#' @export
#' @examples
#' saveVersion("df")
#' df <- latest("df")
saveVersion <- function(s) {
# Create Env and Versions directories
dir.create(file.path("Env"), showWarnings = FALSE)
dir.create(file.path("Env","Versions"), showWarnings = FALSE)
saveRDS(get(s),paste(file.path("Env","Versions", paste0(s,"_",gsub("[: -]", "" , Sys.time(), perl=TRUE),".rds"))))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.