knitr::opts_chunk$set( ########## set global options ############ echo = FALSE, # don't show code collapse = TRUE, # keep code from blocks together (if shown) message = TRUE, # show messages warning = TRUE, # show warnings error = TRUE, # show error messages comment = "", # don't show ## with printed output dpi = 100, # image resolution (typically 300 for publication) fig.width = 6.5, # figure width fig.height = 4.0 # figure height ) # R's default rounding is to show 7 digits. This rounds results to 3 digits. options(digits = 3)
library(conflicted) suppressPackageStartupMessages(library(tidymodels)) tidymodels_prefer() suppressPackageStartupMessages(library(tidyverse)) # suppress "`summarise()` has grouped output by " messages options(dplyr.summarise.inform = FALSE)
library(glue) # for glue() library(rUM) # needed for the bibliography to include the package library(rio) # for import() library(table1) # for table1() if you want to use it instead of gtsummary # gtsummary for tbl_summary(), add_n(), add_p(), modify_header(), bold_labels() suppressPackageStartupMessages(library(gtsummary))
# raw_data <- import("") # your data file goes inside the ""
# preprocess your data and ultimately make a dataset called analysis
Analyses were conducted with r stringr::word(R.Version()$version.string, 1, 3)
with the tidyverse
(r packageVersion("tidyverse")
), rUM
(r packageVersion("rUM")
), gtsummary
(r packageVersion("gtsummary")
) packages used to preprocess and summarize data. [@R-base; @R-tidyverse; @tidyverse2019; @R-rUM; @R-gtsummary]
As can be seen in Table \@ref(tab:table-1) or Table 1
#| fig.cap: "Remember figure references begin with #fig:"
See Figure \@ref(fig:figure1) or Figure 1
# automatically create a bib database for loaded R packages & rUM knitr::write_bib( c( .packages(), "rUM" ), "packages.bib" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.