This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
quarto titlepages v3.0: Demo of customizing a title page | |
https://youtu.be/SZ0WJMHGDps | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[^\x00-\x7F] | |
To fix this, you have to find the Unicode and replace it with it’s ASCII equivalent. To do this: Ctrl-F to find, search for “[^\x00-\x7F]” (without quotes), select “Regex” for regular expressions, and find the “Next” one. | |
# Replace unicode in all variables | |
dat_all <- | |
dat_all |> | |
dplyr::mutate( | |
dplyr::across( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Erik's workflow template for plots in R ggplot2 | |
library(erikmisc) # https://github.com/erikerhardt/erikmisc/ | |
# https://patchwork.data-imaginist.com/articles/guides/layout.html | |
# When lazy evaluation (nonstandard evaluation NSE) is an issue with plots into a list | |
# force evaluation by running cowplot (have not found a better way using force() or eval() or tidy_eval()) | |
# p_list[[ i_plot ]] <- p |> cowplot::plot_grid() | |