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
iris_e <- iris | |
str(iris_e) | |
# from factor to character | |
iris_e <- iris_e %>% dplyr::mutate(tidyselect::across(tidyselect::where(is.factor), as.character)) | |
str(iris_e) | |
# from character to factor | |
iris_e <- iris_e %>% dplyr::mutate(tidyselect::across(tidyselect::where(is.character), as.factor)) | |
str(iris_e) | |
# remove all-NA columns |
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() | |
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
# 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
--- | |
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
--- | |
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 | |
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: 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
quarto titlepages v3.0: Demo of customizing a title page | |
https://youtu.be/SZ0WJMHGDps | |
NewerOlder