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 / melbourne_sun.md
Last active March 10, 2019 07:41
Sunrise and sunset in Melbourne
library(maps)
library(lubridate, warn.conflicts = FALSE)
library(dplyr, warn.conflicts = FALSE)
library(suncalc)
library(lutz)
library(ggplot2)
library(ggrepel)
library(tidyr)
@iangow
iangow / reg_comparison.md
Created April 23, 2019 02:24
Comparison of regressions of y on (x_1, x_2) and on (x_1, x_2 - x_1).
n <- 1000

x_1 <- rnorm(n)
x_2 <- rnorm(n)
e <- rnorm(n)

b_0 <- 0.2
b_1 <- 0.3
b_2 <- 0.4
@iangow
iangow / fog_test.ipynb
Last active April 24, 2019 06:59
Python code to compare Python and Perl fog code
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@iangow
iangow / level_9_classic.md
Created May 2, 2019 00:23
Results for Hopes and Juniors Level 9 Classic (2019-04-14)
library(ggplot2)
library(dplyr, warn.conflicts = FALSE)
library(forcats)
url <- "https://usagym.org/PDFs/Results/2019/r_19l9classic_hopesjr_aa.pdf"

get_scores <- function(url) {
    t <- tempfile(fileext = ".pdf")
    scores_pdf <- download.file(url, t)
@iangow
iangow / wrds_update_out.md
Last active May 19, 2019 18:32
Output from WRDS update script

1. Get wrds_pg repository from GitHub.

igowmbp15:~ igow$ ssh iangow.me
Password:
Last login: Tue May 14 18:15:01 2019 from 192.168.1.1
2009-Mac-Pro:~ igow$ rm -rf ~/git/wrds_pg
2009-Mac-Pro:~ igow$ cd git
2009-Mac-Pro:git igow$ git clone [email protected]:iangow-public/wrds_pg.git
Cloning into 'wrds_pg'...
Date Open High Low Close Adj Close Volume
1992-11-23 1455.000000 1455.000000 1455.000000 1455.000000 1455.000000 0
1992-11-24 1458.400024 1458.400024 1458.400024 1458.400024 1458.400024 0
1992-11-25 1467.900024 1467.900024 1467.900024 1467.900024 1467.900024 0
1992-11-26 1459.000000 1459.000000 1459.000000 1459.000000 1459.000000 0
1992-11-27 1458.900024 1458.900024 1458.900024 1458.900024 1458.900024 0
1992-11-30 1456.400024 1456.400024 1456.400024 1456.400024 1456.400024 0
1992-12-01 1452.300049 1452.300049 1452.300049 1452.300049 1452.300049 0
1992-12-02 1446.800049 1446.800049 1446.800049 1446.800049 1446.800049 0
1992-12-03 1442.099976 1442.099976 1442.099976 1442.099976 1442.099976 0
library(readxl)
library(readr)
library(dplyr, warn.conflicts = FALSE)
library(tidyr)
library(ggplot2)

df <- read_csv(paste0("https://portal.australiansuper.com/layouts/sublayouts/CRCAS", 
                      "/InvestmentsGraphs/DailyRatesChartData.ashx?",
                      "start=1/07/2008&end=29/07/2019&cumulative=False&superType=Pension",
@iangow
iangow / flavors.ipynb
Last active August 17, 2019 02:30
How many different combinations from n flavors of ice cream?
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@iangow
iangow / naics_code.R
Last active August 29, 2019 00:48
Code to rearrange NAICS codes
setwd("C:/Users/mjyje/OneDrive/RA work/vertically related industries")
library(readxl)
library(dplyr, warn.conflicts = FALSE)
library(tidyr)
library(stringr)
library(readr)
# Import input-output matrix ----
@iangow
iangow / math_problem.ipynb
Created December 9, 2019 09:35
Graph for that math problem
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.