Skip to content

Instantly share code, notes, and snippets.

View iangow's full-sized avatar
🏠
Working from home

Ian Gow iangow

🏠
Working from home
View GitHub Profile
@iangow
iangow / event_returns.md
Last active March 29, 2017 01:20
Illustration of new event-study code.

The code below depends on some tables in my crsp schema, including crsp.rets, crsp.anncdates, and crsp.trading_dates. It also depends on a custom aggregate function (product) I have in PostgreSQL.

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
@iangow
iangow / gemma_2017.R
Last active April 9, 2017 14:34
Code to make plots of Gemma's scores.
library(googlesheets)
library(ggplot2)
library(tidyr)
library(dplyr, warn.conflicts = FALSE)
gs <- gs_key("1vMzccNDQnGPLuNmRHe80okvEGZtHQt4xHFBscAZn5hc")
scores <- gs_read(gs)
scores
@iangow
iangow / numerical_intensity.ipynb
Last active April 11, 2017 16:39
Code to extract numerical intensity
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@iangow
iangow / wrds_fetch.md
Last active April 27, 2017 01:03
Code to get data from WRDS into PostgreSQL

Go here for the latest.

@iangow
iangow / wrds_fetch.ipynb
Created April 25, 2017 14:45
Code to illustrate getting data from WRDS to Melbourne.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@iangow
iangow / install_plr.sh
Created April 27, 2017 18:40
Script to install PL/R from GitHub
#!/usr/bin/env bash
cd ~/git
git clone [email protected]:postgres-plr/plr.git
cd plr
R_HOME="/Library/Frameworks/R.framework/Resources" USE_PGXS=1 PG_CONFIG="/opt/local/lib/postgresql96/bin/pg_config" make
sudo R_HOME="/Library/Frameworks/R.framework/Resources" USE_PGXS=1 PG_CONFIG="/opt/local/lib/postgresql96/bin/pg_config" make install
@iangow
iangow / se_hack_to_home.sh
Created May 3, 2017 10:22
Code to get data from work to home
rsync -avz hackintosh:/Volumes/2TB/data/streetevents_project/ \
/Volumes/2TB/data/streetevents_project/ --include=*.xml --delete
@iangow
iangow / install_r.sh
Last active December 30, 2020 16:27
Code to install R from the command line
wget https://cran.rstudio.com/bin/macosx/R-4.0.3.pkg
sudo installer -pkg R-4.0.3.pkg -target /
rm R-4.0.3.pkg
@iangow
iangow / update_packages.R
Last active May 26, 2019 04:57
Code to update packages for new R
old_lib <- "/Library/Frameworks/R.framework/Versions/3.5/Resources/library"
install.packages(list.files(old_lib))
@iangow
iangow / minimal_bookdown.md
Last active May 30, 2017 13:24
Very minimal bookdown.
  1. Within RStudio, create a new RStudio project in a new directory.
  2. Initialize the directory for Git: Do git init in the directory from the command line. (Perhaps this can be done within RStudio.)
  3. Create a file index.Rmd with content from here.
  4. Create a file _bookdown.yml with content similar to this.
  5. Click "Build Website" on the Build tab in RStudio (it may be necessary to close RStudio and open the .Rproj file to get this).
  6. On GitHub for this repository, go to Settings, GitHub Pages, then select "master branch /docs folder" as the source.

Voila.