Skip to content

Instantly share code, notes, and snippets.

View bhoung's full-sized avatar

Brendan Houng bhoung

View GitHub Profile
@bhoung
bhoung / analyzeSGP example.r
Last active December 13, 2015 21:09
generate growth and achievement plot
SGPstateData[["NAPLAN"]][["Growth"]][["System_Type"]] <- "Cohort Referenced"
SGPstateData[["NAPLAN"]][["Student_Report_Information"]][["Grades_Reported"]][["NUMERACY"]] <- c(3, 5, 7)
SGPstateData[["NAPLAN"]][["Assessment_Program_Information"]][["Grades_Tested"]] <- c(3, 5, 7)
SGPstateData$NAPLAN$Growth$Levels <- c("Very Low", "Low", "Typical", "High", "Very High")
SGPstateData[["NAPLAN"]][["Growth"]][["Cutscores"]] <-
list(Cuts=c(20, 40, 60, 80),
Labels=list("1st - 19th", "20th - 39th", "40th - 59th", "60th-79th", "80th-99th"))
#NUM YR3 2008
s1 <- read.dta("C:/Protected/MI/Naplan/sgp/long/YR3_2008.dta")
@bhoung
bhoung / ggmap example.r
Last active December 14, 2015 02:19
using ggmap to create images of melbourne showing a small random sample of schools. A few different map types are shown.
require(ggmap)
require(foreign)
melb <- read.dta("/Users/brendanhoung/example/melb.dta")
melbourne <- qmap(location='melbourne, Australia', zoom = 10) + theme_set(theme_bw())
melbourne_stamen <- qmap(location='melbourne, Australia', zoom = 10, source="stamen", maptype="watercolor")
melbourne_toner <- qmap(location='melbourne, Australia', zoom = 10, source="stamen", maptype="toner")
melbourne_osm <- qmap(location='melbourne, Australia', zoom = 10, source="osm")
@bhoung
bhoung / trueskill_ex2.r
Last active September 30, 2021 02:51
Example 2. Running trueskill algorithm on a tennis tournament.
# This second example runs Trueskill on a tennis tournament, the Australian Open.
# Note that actual computation is commented out as it takes about ~40 seconds to
# update skill ratings over 127 matches.
library(trueskill)
# Data format of ausopen2012 is: Player, Opponent, Margin, Round, WRank, LRank
data("ausopen2012")
# create match_id in order to reshape
@bhoung
bhoung / time lapse.R
Created June 18, 2013 00:45
R code to create a map time lapse with ggplot and ffmpeg
setwd("C:/Documents and Settings/bhoung/My Documents/time/")
require("ggplot2")
require("maptools")
gpclibPermit()
# read in spatial data - from the ABS (Australian Burea of Statistics) website
shp <- readShapeSpatial( fn = "C:/Documents and Settings/bhoung/My Documents/asgc/SLA11aAust", verbose = TRUE, delete_null_obj=TRUE)
summary(shp)
list_names = names(shp)
@bhoung
bhoung / k-fold CV.r
Created April 24, 2014 00:52
starter code for k fold cross validation using the iris dataset
# original example from Digg Data website (Takashi J. OZAKI, Ph. D.)
# http://diggdata.in/post/58333540883/k-fold-cross-validation-in-r
library(plyr)
library(randomForest)
data <- iris
# in this cross validation example, we use the iris data set to
-- https://www.slideshare.net/redongjun/simple-json-parser
-- https://www.youtube.com/watch?v=r_Enynu_TV0
import Text.ParserCombinators.Parsec
import Control.Monad
matchTrue :: Parser String
matchTrue = string "true"
@bhoung
bhoung / 2021-06-17-nba-bbr.Rmd
Created June 19, 2021 12:17
'21 nets performance in games missed by stars r markdown
---
title: "'21 Brooklyn Nets performance in games missed by stars"
layout: post
categories:
- notebook
tags:
- nba, sports
output:
html_document
# md_document:
@bhoung
bhoung / 2021-06-19-nba-21-bbr.Rmd
Created June 27, 2021 06:40
R markdown notebooks accompanying yt screencast
---
title: "Basketball Reference"
layout: post
categories:
- notebook
tags:
- nba, sports
output:
html_document
# md_document:
---
title: Minutes played by Nets, playoffs
layout: post
categories:
- posts
tags:
- nba, sports
output:
#html_document
md_document: