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: "Samples can be smaller than you think" | |
output: | |
flexdashboard::flex_dashboard: | |
vertical_layout: scroll | |
runtime: shiny | |
--- | |
```{r setup, include = FALSE} | |
library(tidyverse) |
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
library(magrittr) | |
## Given a vector, calculate both the mean and standard deviation | |
mean_sd = function(vec) { | |
list(mean = mean(vec), | |
sd = sd(vec)) | |
} | |
d20 = function() sample.int(20, 1) |
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
library(tidyverse) | |
## Parameters ---- | |
## How many people have questions? | |
n_questions = 30 | |
## How many questions will actually get answered? | |
max_questions = 15 | |
## How many times to run the simulation? | |
N = 500 |
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
/*-- scss:rules --*/ | |
.mermaid svg { | |
max-width: 100%; | |
height: auto; | |
} | |
#Argument rect { | |
stroke:transparent; | |
fill:#e5e5e5!important; | |
} |
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
library(tidyverse) | |
theme_set(theme_minimal()) | |
library(broom) | |
one_sim = function(id, n = 100) { | |
dataf = tibble(x1 = rnorm(n, 0, 1), | |
x2 = rnorm(n, 0, 1), | |
eps = rnorm(n, 0, .1), | |
y = 1 + x1 + 3*x1*x2 + eps) | |
coef_df = lm(y ~ x1 + x2, dataf) |> |
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
library(tidyverse) | |
# Sys.unsetenv('GITHUB_PAT') | |
# remotes::install_github('https://github.com/hrbrmstr/waffle') | |
library(waffle) | |
## <https://www.npr.org/sections/goatsandsoda/2021/08/20/1029628471/highly-vaccinated-israel-is-seeing-a-dramatic-surge-in-new-covid-cases-heres-why> | |
## "half of Israel's seriously ill patients who are currently hospitalized were fully vaccinated at least five months ago" | |
# vaxx rate: 78% |
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
## From <https://github.com/tidymodels/TMwR/blob/master/index.Rmd> | |
```{r pkg-list, echo = FALSE, results="asis"} | |
deps <- desc::desc_get_deps() | |
pkgs <- sort(deps$package[deps$type == "Imports"]) | |
pkgs <- sessioninfo::package_info(pkgs, dependencies = FALSE) | |
df <- tibble::tibble( | |
package = pkgs$package, | |
version = pkgs$ondiskversion, | |
source = gsub("@", "\\\\@", pkgs$source) | |
) |
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
## Parses a roster page saved from Canvas and allocates students to groups within discussion sections | |
## To use: | |
## 1. Navigate to the People page in a Canvas course using your browser | |
## 2. Right-click on the page and select "Save as" | |
## 3a. `Rscript parse.R path/to/roster.html` | |
## -OR- | |
## 3b. Save it to `data_folder` as `roster.html`. `Rscript parse.R` or run in RStudio. | |
## Setup ---- |
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
## If one group is much larger than the other, does this | |
## inflate type I error rates or bias estimates? | |
library(tidyverse) | |
library(broom) | |
library(tictoc) | |
set.seed(2020-03-16) | |
## Parameters ---- | |
a_n = 300 |
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
#!/bin/bash | |
## Just a little Bash wrapper for a Ghostscript call | |
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile="$2" "$1" |
NewerOlder