Last active
August 24, 2016 19:58
-
-
Save benjamin-chan/50d4ffd33acb2447be71eeb16eb5ba4f to your computer and use it in GitHub Desktop.
Template for R make file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setwd("H:/Projects") # Set project directory | |
Sys.time0 <- Sys.time() | |
sink("make.log") | |
files <- c("file1.Rmd", # File 1 | |
"file2.Rmd", # File 2 | |
"file3.Rmd") # File 3 | |
f <- file("master.Rmd", open = "w") | |
for (i in 1:length(files)) { | |
x <- readLines(files[i]) | |
writeLines(x, f) | |
if (i < length(files)) {writeLines("\n---\n", f)} | |
} | |
close(f) | |
library(knitr) | |
library(rmarkdown) | |
knit("master.Rmd", output = "index.md") | |
file.remove("master.Rmd") | |
sink("session.log") | |
list(completionDateTime = Sys.time(), | |
executionTime = Sys.time() - Sys.time0, | |
sessionInfo = sessionInfo()) | |
sink() | |
sink() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment