-
Notifications
You must be signed in to change notification settings - Fork 11
/
r-config.qmd
67 lines (56 loc) · 2.26 KB
/
r-config.qmd
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!-- ::: {.content-hidden when-format="revealjs"} -->
---
### Configuring R {.unnumbered}
Functions from these packages will be used throughout this document:
```{r}
#| label: "packages"
#| message: false
library(conflicted) # check for conflicting function definitions
# library(printr) # inserts help-file output into markdown output
library(rmarkdown) # Convert R Markdown documents into a variety of formats.
library(pander) # format tables for markdown
library(ggplot2) # graphics
library(ggeasy) # help with graphics
library(ggfortify) # help with graphics
library(dplyr) # manipulate data
library(tibble) # `tibble`s extend `data.frame`s
library(magrittr) # `%>%` and other additional piping tools
library(haven) # import Stata files
library(knitr) # format R output for markdown
library(tidyr) # Tools to help to create tidy data
library(plotly) # interactive graphics
library(dobson) # datasets from Dobson and Barnett 2018
library(parameters) # format model output tables for markdown
library(haven) # import Stata files
library(latex2exp) # use LaTeX in R code (for figures and tables)
library(fs) # filesystem path manipulations
library(survival) # survival analysis
library(survminer) # survival analysis graphics
library(KMsurv) # datasets from Klein and Moeschberger
library(parameters) # format model output tables for
library(webshot2) # convert interactive content to static for pdf
library(forcats) # functions for categorical variables ("factors")
library(stringr) # functions for dealing with strings
library(lubridate) # functions for dealing with dates and times
```
Here are some R settings I use in this document:
```{r}
#| label: "r-config"
#| message: false
rm(list = ls()) # delete any data that's already loaded into R
conflicts_prefer(dplyr::filter)
ggplot2::theme_set(
ggplot2::theme_bw() +
# ggplot2::labs(col = "") +
ggplot2::theme(
legend.position = "bottom",
text = ggplot2::element_text(size = 12, family = "serif")))
knitr::opts_chunk$set(message = FALSE)
options('digits' = 4)
panderOptions("big.mark", ",")
pander::panderOptions("table.emphasize.rownames", FALSE)
pander::panderOptions("table.split.table", Inf)
conflicts_prefer(dplyr::filter) # use the `filter()` function from dplyr() by default
legend_text_size = 9
```
<!-- ::: -->