library(tidyverse)
library(DBI)
library(googlesheets4)
options(gargle_oauth_email = TRUE)
gs_2024 <- as_sheets_id("1Qymhw_LGN1Z00ip_qswa29yPeZzWvTymD-u-lMY8b-A")
nnhs_2024 <- read_sheet(gs_2024, na = c("", "N/A"))
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(farr) | |
library(tidyverse) | |
original <- read_csv("~/Downloads/WalkerDataCodeMar2021/original.csv") | |
original |> | |
group_by(fyear) |> | |
summarize(auc = auc(prob, aaer), .groups = "drop") |> | |
mutate(avg_auc = mean(auc)) |
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
install.packages(c("formatR", "markdown", "tinytex", "downlit", "xml2")) |
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(dplyr, warn.conflicts = FALSE) | |
library(DBI) | |
db <- dbConnect(duckdb::duckdb()) | |
dbExecute(db, "ATTACH '' AS pg (TYPE POSTGRES);") | |
dbExecute(db, "COPY pg.crsp.dsf FROM '/Users/iangow/Library/CloudStorage/Dropbox/pq_data/crsp/dsf.parquet'") | |
create_view <- function(conn, table, schema = "", |
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(httr2) # request(), req_*(), resp_body_html() | |
library(rvest) # html_elements(), html_table() | |
library(tidyverse) | |
extract_team_ids <- function(link_text) { | |
matches <- str_match(link_text, '<a href="teams/(.*)_idx.html">(.*)</a>') | |
team_id <- matches[, 2] | |
team_name <- matches[, 3] | |
tibble(team_id, team_name) | |
} |
library(tidyverse)
regions <- c("USA", "Australia", "China")
years <- 2017:2023L
markets <- letters[1:4]
nn <- 1000
sample_n <- function(var, n = nn) {
var <- rlang::ensym(var)
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: "Alternative text for figures" | |
author: Ian D. Gow | |
date: 2024-04-25 | |
date-format: "D MMMM YYYY" | |
bibliography: book.bib | |
format: docx | |
--- | |
```{r} |
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(stringr) | |
library(dplyr) | |
path = getwd() | |
file_list <- | |
tibble(full_path = list.files(path, full.names = TRUE)) |> | |
filter(str_detect(full_path, "\\.(qmd)$")) | |
get_libraries <- function(file) { |
NewerOlder