#specify which state should be used
<- STATE_vec[i] this_STATE
8 qmd/Rmd
8.1 Loop with child (sub file)
Main-file: main.qmd
Sub-file: stateplot.qmd
Output: main.html
## Individual States
# results: asis #output raw md content
<- c("AL", "AK", "AZ", ...)
STATE_vec
#create empty list
<- vector("list", length = 3L)
res
#run loop
for (i in 1:length(STATE_vec)) {
#run sub w/ state, save in list
<- knitr::knit_child(
res[[i]] "stateplot.qmd"
quiet = TRUE
, envir = environment()
,
)
}
#unlist and paste together w/ a break
cat(unlist(res), sep = '\n')
### `r this_STATE`
%>%
all_data filter(STATE == this_STATE) %>%
plot_function()
Individual States
AL
AK
AZ
8.2 quarto_render()
- issue rendering qmd and saving in another folder
- my work around is rendering in same place and moving to another folder and new name, then remove the rendered html
- links
#when bugs are fixed
# quarto::quarto_render(input = "in.qmd", output_file = "products/output.html")
::quarto_render(input = "ind.qmd", output_file = "output.html")
quartofile.copy(from = "output.html", to = "products/output.html", overwrite = TRUE)
rm("output.html")
8.3 Output and Pathways
8.4 Style
- Stack Overflow | R markdown: how to change style with internal css?
- Stack Overflow | rmarkdown: both portrait and landscape layout in a single PDF
- R Markdown Cookbook | 4.4 Unnumbered sections
- Stack Overflow | Increase width of entire HTML Rmarkdown output
- Steve Sque | Symbols in LaTeX and HTML
- RStudio Community | Copy to clipboard buttons for code blocks - R Markdown