Skip to content

Instantly share code, notes, and snippets.

@HughParsonage
HughParsonage / get_res_dwel_stats.R
Created January 7, 2016 02:47
Using ABS SDMX including metadata
library(rsdmx)
library(data.table)
library(dplyr)
res_dwelling_values_metadata <-
readSDMX("http://stat.abs.gov.au/restsdmx/sdmx.ashx/GetDataStructure/RES_DWEL_ST/ABS")
recode_res_dwelling_values <- function(DT, colname){
cls <- slot(res_dwelling_values_metadata, "codelists")
codelists <- sapply(slot(cls, "codelists"), function(x) slot(x, "id"))
@HughParsonage
HughParsonage / fin_stress_age_welfare_renting.R
Created February 2, 2016 23:09
Financial stress by age group, on/off welfare, renting/not renting, from HES2009-10
library(data.table)
library(ggplot2)
library(scales)
library(grattan)
library(readxl)
library(grid)
# The Housing Expenditure Survey (STATA) file
# 2009-10
# requires authority from ABS in order to access.
@HughParsonage
HughParsonage / how_ATO_sample_cols_are_related.R
Last active April 22, 2024 00:05
How are the columns of the ATO's 2% sample file related?
@HughParsonage
HughParsonage / knitr-ggplot2-flush-margin.Rnw
Created March 13, 2016 03:28
Including charts in knitr where plot background has the same margin as figure width
\documentclass[twocolumn, landscape]{article}
\usepackage{geometry}
\usepackage{float, placeins}
\addtolength{\columnsep}{25pt}
\usepackage{lipsum}
\title{Making charts in \LaTeX{} + \texttt{knitr} where $x = 0$ is on the left margin.}
@HughParsonage
HughParsonage / numbers2words.R
Created April 17, 2016 03:40 — forked from psychemedia/numbers2words.R
R function to convert numbers to words
#https://github.com/ateucher/useful_code/blob/master/R/numbers2words.r
numbers2words <- function(x){
## Function by John Fox found here:
## http://tolstoy.newcastle.edu.au/R/help/05/04/2715.html
## Tweaks by AJH to add commas and "and"
helper <- function(x){
digits <- rev(strsplit(as.character(x), "")[[1]])
nDigits <- length(digits)
if (nDigits == 1) as.vector(ones[digits])
library(taxstats)
library(grattan)
library(data.table)
library(dplyr)
library(magrittr)
n_affected_by_div293 <- function(div293.threshold = 300e3, cap = 30000, cap2 = 35000, age_based_cap = TRUE, div293 = TRUE, super.guarantee.rate = 0.095, use.sample.file = "2013-14", h = 0L){
sample_file_extended <-
# sample_files_all[fy.year == use.sample.file] %>%
sample_file_1314 %>%
library(rvest)
library(dplyr)
library(tidyr)
library(xml2)
library(data.table)
url_act_electorates_outrights <-
"http://www.sportsbet.com.au/betting/politics/australian-federal-politics/outrights?ev_oc_grp_id=1971028"
url_nt <-
"http://www.sportsbet.com.au/betting/politics/australian-federal-politics/outrights?ev_oc_grp_id=1971052"
library(magrittr)
library(data.table)
library(dplyr)
library(dtplyr)
library(broom)
library(grid)
library(gridExtra)
library(gtable)
library(ggplot2)
library(ggthemes)
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="pandoc" />
number words
1 one
2 two
3 three
4 four
5 five
6 six
7 seven
8 eight
9 nine