Make

load helpers

source("0__helpers.R")

render_web("index.Rmd", include_top = NULL)

spin all R scripts

since all R scripts are either source files or meant for the cluster we just want to document R scripts

just_document = all_Rs = c(list.files(pattern = "\\.R$", full.names = TRUE), list.files(path = "cluster", pattern = "\\.R$", full.names = TRUE))
for(i in seq_along(all_Rs)) {
    just_document[i] = spin(all_Rs[i],knit=FALSE,envir = new.env(), format = "Rmd", )
}

after spinning into Rmds, render them, but don’t evaluate code

opts_chunk$set(eval=FALSE, cache=FALSE)
for(i in seq_along(just_document)) {
    if (dirname(just_document[i]) == "cluster") {
        file.rename(just_document[i], basename(just_document[i]))
        just_document[i] = basename(just_document[i])
    }
    render_web(just_document[i], auto_tab = FALSE)
}

remove the temporary Rmd files left over from spinning

unlink(just_document)

now render the md files. these are usually from scripts I had to run on the cluster for memory reasons

all_mds = list.files(pattern = "\\.md$")
for(i in seq_along(all_mds)) {
    render_web(all_mds[i])
}

all other scripts should be evaluated

opts_chunk$set(eval=TRUE, cache = TRUE)

library(stringr)
done = str_sub(all_mds,1, -4)

all_rmds = list.files(pattern = ".Rmd$")
todo = str_sub(all_rmds, 1, -5)
rmds_left = all_rmds[ !todo %in% done ]

rmds_left = list.files(pattern = "^2[^e]+_main_.+.Rmd$")
for(i in seq_along(rmds_left)) {
    render_web(rmds_left[i])
}