# Set options here
options(golem.app.prod = FALSE) # TRUE = production mode, FALSE = development mode
# Detach all loaded packages and clean your environment
golem::detach_all_attached()
rm(list=ls(all.names = TRUE))
# Document and reload your package
golem::document_and_reload()
# [M.E.] Debug utils
if (!getOption("golem.app.prod")){
# 0. Instancie le chemin vers les 'checkpoints'
checkpoint.path <- "./dev/checkpoints" # the working directory of the app is inst/app
dir.create(checkpoint.path, showWarnings = F)
# 1.1 Fonction de sauvegarde des variables
checkpoint.save <- function(...){
print(getwd())
args <- list(...)
print(names(args))
for (arg_name in names(args))
saveRDS(args[[arg_name]], file.path(checkpoint.path, arg_name))
}
# 1.2 Fonction pour restaurer toutes les variables du dossier checkpoint
checkpoint.restore <- function(path = checkpoint.path){
for (filename in list.files(path))
assign(filename, readRDS(file.path(path, filename)), envir = .GlobalEnv)
}
# 1.3 Fonction pour vider le dossier checkpoint
checkpoint.empty <- function(path = checkpoint.path){
# TODO
}
}
# Run the application
triangle.tlbx::run_app(dev_mode = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.