- Sections and subsections numbered like "II.A.1" (add following to end of preamble)
-
\renewcommand{\thesection}{\Roman{section}}
-
\renewcommand{\thesubsection}{\thesection.\Alph{subsection}}
-
\renewcommand{\thesubsubsection}{\thesubsection.\arabic{subsubsection}}
-
- roman numeraled endnotes instead of footnotes (add following to preamble)
- \usepackage{endnotes}
- \let\footnote=\endnote
- \renewcommand{\theendnote}{\roman{endnote}}
- put "\theendnotes" just before the online appendix
This file contains hidden or 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
# Required libraries | |
library(RNHANES) | |
library(tidyverse) | |
library(survey) | |
library(haven) | |
library(stats) | |
library(readr) | |
library(patchwork) | |
library(scales) |
This file contains hidden or 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
using Statistics, BenchmarkTools, DataFrames, Random | |
Random.seed!(1234) | |
mutable struct allParmsM | |
x::Float64 | |
end | |
# fill in the mutable struct with the values | |
allpM = allParmsM( | |
5.784 # x |
This file contains hidden or 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
library(tidyverse) | |
library(openai) | |
#------------------------------------------------------------------------------- | |
# Step 1: Open AI API key | |
#------------------------------------------------------------------------------- | |
# Your OpenAI API key should be an environment variable you set in ~.Renviron | |
# ... you should never put your API key directly in your code! |
This file contains hidden or 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
* Dodging local macros (backtick) | |
* works | |
file open tb using "test1.tex", write replace | |
file write tb "These are backticks: " "`" "`" "air quotes''. "_n | |
file close tb | |
* works | |
!echo "These are backticks:" "`=char(92)'`=char(96)'""`=char(92)'`=char(96)'""air quotes''." > test2.tex |
This file contains hidden or 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
library(ggplot2) | |
# create a matrix with the given points | |
pts <- matrix(c(3, 3, 3, 3, 3, 3, 3, 0.5, -1, -3, 1, 1.5, 2.75, 3, 1.25, 1.75, 0, 4, 8, 12, 16, 20, 23, 24, 25, 37, 38.5, 48, 60, 69, 71, 84), ncol = 2, byrow = F) | |
# sort the points by x value | |
pts <- pts[order(pts[, 2]), ] | |
# create the spline interpolation function | |
interp <- splinefun(pts[, 2], pts[, 1], method = "natural") |
This file contains hidden or 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
library(tidyverse) | |
library(magrittr) | |
library(pdftools) | |
# get a timeline of movement to test optional from fairtest.org | |
# url accessed on 30 Jun 2022 | |
optl <- pdf_text(pdf = "https://www.fairtest.org/sites/default/files/Optional-Growth-Chronology.pdf") %>% str_split('\n') | |
optdf <- list() | |
for (i in seq(1:18)) { | |
print(length(optl[[i]])) |
This file contains hidden or 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
wait_for_key(prompt) = (print(stdout, prompt); read(stdin, 1); nothing) | |
user_input(prompt) = (print(prompt); p = readline(); p) | |
function spin() | |
wait_for_key("Press enter to spin\n") | |
spun = rand(1:6) | |
println("You spun a ",spun) | |
return spun | |
end |
This file contains hidden or 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
library(NHANES) | |
library(tidyverse) | |
library(magrittr) | |
library(modelsummary) | |
df <- as_tibble(NHANES) | |
datasummary_skim(df, type="categorical") | |
datasummary_skim(df, type="numeric") |
This file contains hidden or 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
library(tidyverse) | |
letters <- read_csv("https://gist.githubusercontent.com/tyleransom/c197d17b745870a464926435b95d7d9c/raw/3fd2cf7f50ecd9c04bd5adfbe4892f490730a560/beads.csv") | |
ggplot(data=letters, aes(x=`letter/character`)) + | |
geom_bar() + | |
geom_text(stat='count', aes(label=..count..), vjust=-1) + | |
theme_minimal() |
NewerOlder