library(ggplot2)
library(DBI)
library(dplyr, warn.conflicts = FALSE)
library(dbplyr, warn.conflicts = FALSE)
now <- Sys.time()
conn <- dbConnect(duckdb::duckdb())
file_path <- "~/data/crsp/dsf.parquet"
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(DBI) | |
library(dplyr, warn.conflicts = FALSE) | |
library(farr) # for load_parquet() | |
library(arrow) | |
db <- dbConnect(duckdb::duckdb(), | |
dbdir = "~/Downloads/seattle.duckdb", | |
read_only = TRUE) | |
dbListTables(db) |
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) | |
Sys.setenv(PGHOST = "wrds-pgdata.wharton.upenn.edu", | |
PGDATABASE = "wrds", | |
PGUSER = "iangow", | |
PGPORT = 9737) | |
db <- dbConnect(duckdb::duckdb()) |
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) | |
library(rvest, warn.conflicts = FALSE) | |
css_selector <- "#main-table > tbody:nth-child(6)" | |
read_df <- function(page, prefix = "pre_") { | |
url <- paste0("~/Desktop/SSRN/", prefix, page, ".html") | |
html <- read_html(url) | |
df <- | |
html |> |
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) | |
library(DBI) | |
library(slider) | |
library(furrr) | |
tidy_finance <- dbConnect( | |
RSQLite::SQLite(), | |
"data/tidy_finance.sqlite", | |
extended_types = TRUE) |
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) | |
library(DBI) | |
library(dbplyr) | |
ddb <- dbConnect( | |
duckdb::duckdb(), | |
"data/tidy_finance.duckdb", | |
read_only = FALSE | |
) |
library(tidyverse)
library(readabs)
#> Environment variable 'R_READABS_PATH' is unset. Downloaded files will be saved in a temporary directory.
#> You can set 'R_READABS_PATH' at any time. To set it for the rest of this session, use
#> Sys.setenv(R_READABS_PATH = <path>)
raw_abs <- read_abs("5601.0")
#> Finding URLs for tables corresponding to ABS catalogue 5601.0
#> Attempting to download files from catalogue 5601.0, Lending Indicators
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) | |
hgt_mean <- 165 | |
hgt_sd <- 8 | |
get_hgt_sample <- function(n) { | |
rnorm(n, mean = hgt_mean, sd = hgt_sd) | |
} | |
get_hgt_samples <- function(n_samples, n) { |
The following simulation examines the phenomenon of cosmic habituation discussed in a New Yorker article, "The Truth Wears Off", and examined in Thinking Clearly with Data.
I conjecture that this is driven by underpowered initial studies, which are only observed if "statistically significant" results are found. Follow-up studies tend to have larger samples and find smaller apparent effects.
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
mkdir /Volumes/OWC1/pg_data15 | |
/Applications/Postgres.app/Contents/Versions/15/bin/initdb -D /Volumes/OWC1/pg_data15 \ | |
--encoding=UTF-8 --locale=en_US.UTF-8 -U postgres | |
/Applications/Postgres.app/Contents/Versions/15/bin/pg_upgrade \ | |
-b /Applications/Postgres.app/Contents/Versions/14/bin \ | |
-B /Applications/Postgres.app/Contents/Versions/15/bin \ | |
-d /Volumes/OWC1/pg_data14 -D /Volumes/OWC1/pg_data15 -v |