Skip to content

Instantly share code, notes, and snippets.

View erikerhardt's full-sized avatar

Erik Erhardt erikerhardt

View GitHub Profile
@erikerhardt
erikerhardt / erik_qmd_template_presentation_pptx.qmd
Created December 15, 2023 01:41
erik_qmd_template_presentation_pptx.qmd
---
title: Title
subtitle: Subtitle
author: Erik Erhardt
date: last-modified # today, now, last-modified
#date-format: long # full, long, medium, short, iso, https://quarto.org/docs/reference/dates.html
date-format: "MM/DD/YYYY \\ hh:mm:ss A ZZ"
google-scholar: true
author-title: Author
affiliation-title: Affiliation
@erikerhardt
erikerhardt / quarto extensions
Created August 1, 2023 14:28
quarto extensions
quarto titlepages v3.0: Demo of customizing a title page
https://youtu.be/SZ0WJMHGDps
@erikerhardt
erikerhardt / quarto_table_figure_captions_template
Last active July 24, 2023 16:21
quarto_table_figure_captions_template
# https://quarto.org/docs/authoring/tables.html
```{r}
#| label: tbl-example
#| tbl-cap: "Example caption can
#| continue on the next line"
#| tbl-subcap:
#| - "Cars"
#| - "Pressure"
#| layout-ncol: 2
#| echo: fenced
@erikerhardt
erikerhardt / knitr_helpers.R
Created October 25, 2022 23:27
knitr helpers
# from inline to yaml chunk options
knitr::convert_chunk_header()
# Verbatim engine for instruction
# https://bookdown.org/yihui/rmarkdown-cookbook/verbatim-code-chunks.html
@erikerhardt
erikerhardt / read_fn_current.R
Created September 5, 2022 14:38
Read current (most recent) files in folder
## Read current files
# Assumed file naming structure is Filename_YYYYMMDD.csv
# list of all files
fn_list_data_raw <- dir("data/")
# filenames to match
fn_dat_list_in <-
c(
@erikerhardt
erikerhardt / Summary_tables_example.qmd
Last active September 9, 2023 15:57
Tables using gtsummary: Table 1 (demographics), regression, contingency table, etc.
---
title: Tables using `gtsummary`
subtitle: Example workflow for Table 1 (demographics), regression, contingency table, etc.
author: Erik Erhardt
date: last-modified # today, now, last-modified
date-format: long # full, long, medium, short, iso, https://quarto.org/docs/reference/dates.html
format:
html:
theme: litera
highlight-style: atom-one
@erikerhardt
erikerhardt / erik_qmd_template_simple.qmd
Last active December 15, 2023 01:40
A qmd quarto template document, simple
---
title: Title
subtitle: Subtitle
author: Erik Erhardt
date: last-modified # today, now, last-modified
date-format: long # full, long, medium, short, iso, https://quarto.org/docs/reference/dates.html
format:
html:
theme: litera
highlight-style: atom-one
@erikerhardt
erikerhardt / erik_qmd_template.qmd
Last active December 15, 2023 01:40
A qmd quarto template document, full
---
title: Title
subtitle: Subtitle
description: |
A qmd quarto template document.
abstract: |
Document abstract may be somewhat long.
author:
- name: Erik Erhardt
url: https://StatAcumen.com/about
https://cran.r-project.org/web/packages/dplyr/vignettes/programming.html
# let var_xs and var_name_y be character strings with variable names, then:
geom_point(
data = dat_cont
, aes(x = !!rlang::sym(var_xs), y = !!rlang::sym(var_name_y))
, alpha = geom_point_alpha
)
# path
path_original <- setwd(path)
on.exit(setwd(path_original), add = TRUE)
## Example error capture
# First check if effect is involved in interactions
check_message <-
e_message_capture(