forked from muschellij2/Neurohacking
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile.R
More file actions
28 lines (24 loc) · 717 Bytes
/
makefile.R
File metadata and controls
28 lines (24 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
library(knitr)
library(tools)
homedir = getwd()
sections = list.files(path = homedir,
full.names=TRUE, pattern="\\.(Rnw|Rmd)$",
recursive=TRUE)
# rmds = sections[grep("md$", sections)]
# rnws = sections[grep("nw$", sections)]
for (isec in seq_along(sections)){
section = sections[isec]
folname = dirname(section)
setwd(folname)
knit(input=section)
if (grepl("nw$", section)){
sname = basename(section)
sname = gsub("\\.Rnw", "", sname)
system(sprintf("pdflatex %s", sname))
system(sprintf("bibtex %s", sname))
system(sprintf("pdflatex %s", sname))
system(sprintf("pdflatex %s", sname))
}
purl(input=section)
}
setwd(homedir)