generated from byu-transpolab/template_quarto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchapter_start.R
40 lines (34 loc) · 1.39 KB
/
chapter_start.R
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# load R libraries here; the `include` flag in the chunk options above tells
# whether to print the results or not. Usually you don't want to print the
# library statements, or any code on the pdf.
# Main Packages ========
# I use these in every doc
library(tidyverse)
library(knitr)
library(kableExtra)
library(modelsummary)
library(targets)
options(dplyr.summarise.inform = FALSE)
# Instructions and options =========
# doesn't wrap numbers in tags latex can't handle
options(modelsummary_format_numeric_latex = "plain")
# prints missing data in tables as blank space
options(knitr.kable.NA = '')
# tells kableExtra to not load latex table packages in the chunk output
# options(kableExtra.latex.load_packages = FALSE)
# round and format numbers that get printed in the text of the article.
# inline_hook <- function(x) {
# if (is.numeric(x)) {
# format(x, digits = 3, big.mark = ",")
# } else x
# }
# knitr::knit_hooks$set(inline = inline_hook)
# knitr::opts_chunk$set(echo = TRUE, cache = TRUE)
# options for latex-only output
if(knitr::is_latex_output()) {
knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE, dev = 'tikz', sanitize = TRUE)
}
# if(knitr::pandoc_to("docx")) {
# knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE)
# }
# knitr::opts_chunk$set(echo = FALSE, message=FALSE, warning = FALSE, fig.align = "center", dev = "cairo_pdf", fig.pos = "H")