- 1.5 gallons water
- 3 cup sugar
- 2 cups Ginger
- 2 lb. Blueberry (primary)
- EC-1118
Starting Gravity: 1.055
# Calling the panel identifiers as id, year | |
df %>% | |
mutate(present = 1) %>% | |
complete(nesting(id), year) %>% | |
mutate(present = replace_na(present, 0)) %>% | |
select(id, year, present) %>% | |
pivot_wider(names_from = year, values_from = present) |
library(texreg) | |
extract_body <- function(gt) { | |
if(inherits(gt, "gt_tbl")) gt <- as.character(gt::as_latex(gt)) | |
stringr::str_match(gt, "(?s)\\\\midrule\\n(.*)\\\\bottomrule")[[2]] | |
} | |
df <- tibble( | |
treat = 1:20 > 10, |
library(tidyverse) | |
library(sf) | |
library(tigris) | |
library(rmapshaper) | |
source("https://gist.githubusercontent.com/kylebutts/7dc66a01ec7e499faa90b4f1fd46ef9f/raw/15196997e5aad41696b03c49be3bfaaca132fdf2/theme_kyle.R") | |
counties <- tigris::counties(class = "sf") %>% | |
# Continental | |
filter(!(STATEFP %in% c("02", "15", "60", "66", "69", "72", "78"))) %>% |
gistup |
library(tidyverse) | |
df <- mtcars %>% | |
group_by(cyl) %>% | |
summarize(mean_mpg = mean(mpg), sd_mpg = sd(mpg)) %>% | |
mutate( | |
mpg_tex = paste0(format(round(mean_mpg, 2), nsmall = 2), " (", format(round(sd_mpg, 2), nsmall = 2), ")"), | |
tex = paste(cyl, mpg_tex, sep = " & ") | |
) |
treat | age | ed | black | hisp | married | nodeg | re74 | re75 | re78 | age2 | |
---|---|---|---|---|---|---|---|---|---|---|---|
1 | 37 | 11 | 1 | 0 | 1 | 1 | 0 | 0 | 9930.0458984375 | 1369 | |
1 | 22 | 9 | 0 | 1 | 0 | 1 | 0 | 0 | 3595.89404296875 | 484 | |
1 | 30 | 12 | 1 | 0 | 0 | 0 | 0 | 0 | 24909.44921875 | 900 | |
1 | 27 | 11 | 1 | 0 | 0 | 1 | 0 | 0 | 7506.14599609375 | 729 | |
1 | 33 | 8 | 1 | 0 | 0 | 1 | 0 | 0 | 289.789886474609 | 1089 | |
1 | 22 | 9 | 1 | 0 | 0 | 1 | 0 | 0 | 4056.49389648438 | 484 | |
1 | 23 | 12 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 529 | |
1 | 32 | 11 | 1 | 0 | 0 | 1 | 0 | 0 | 8472.158203125 | 1024 | |
1 | 22 | 16 | 1 | 0 | 0 | 0 | 0 | 0 | 2164.02197265625 | 484 |
## ----------------------------------------------------------------------------- | |
## oaxaca-blinder-estimator.R | |
## Kyle Butts, CU Boulder Economics | |
## | |
## This creates R functions for an Oaxaca-Blinder Estimator following: | |
## Patrick Kline - Oaxaca-Blinder as a Reweighting Estimator (2011) | |
## Patrick Kline - A note on variance estimation for the Oaxaca estimator of average treatment effects (2014) | |
## ----------------------------------------------------------------------------- | |
This borrows a lot from https://github.com/darinchristensen/conley-se
Reproducible Example here: https://github.com/kylebutts/reprex
This function returns Spatial HAC from Conley (1999):
#' Requires gt::gt() object or gt::as_latex() object and returns just the body of the gt table | |
extract_body_gt <- function(gt) { | |
if(inherits(gt, "gt_tbl")) gt <- as.character(gt::as_latex(gt)) | |
stringr::str_match(gt, "(?s)\\\\midrule\\n(.*)\\\\bottomrule")[[2]] | |
} | |
library(tidyverse, warn.conflicts = FALSE) | |
library(gt, warn.conflicts = FALSE) | |
# HTML |