The goal of mytidytuesday is to hold small projects. They are like blogs posts, but mostly code. In the spirit of #tidytuesday no pressure to write prose!
Initially, I planned to work on #tidytuesday stuff, but I ended up just working on problems that arose in my work and personal interests.
new_experiment_rmd <- function(name){
dir <- paste0(Sys.Date(), "-", name)
dir.create(dir, recursive = F)
filepath <- paste0(dir, "/", name, ".Rmd")
readLines("experiment-template.Rmd") |>
writeLines(filepath)
}
new_experiment_rmd(name = "geom_vline_internals")
new_document <- function(name, type = "xaringan"){
dir <- paste0(Sys.Date(), "-", name)
if(!exists(dir)){dir.create(dir, recursive = F)}
extension = if(type == "xaringan"){".Rmd"}else{".qmd"}
filepath <- paste0(dir, "/", name, extension)
if(type == "xaringan"){template <- "0000-00-00-templates/xaringan_template.Rmd"}
if(type == "quarto"){template <- "0000-00-00-templates/quarto_template.qmd"}
if(!exists(filepath)){
readLines(template) |>
writeLines(filepath)
}
rstudioapi::documentOpen(filepath)
}
new_xaringan <- function(...){new_document(..., type = "xaringan")}
new_quarto <- function(...){new_document(..., type = "quarto")}
new_xaringan(name = "dummy")