Skip to content

Instantly share code, notes, and snippets.

Avatar

Brendan Houng bhoung

View GitHub Profile
View 2021-06-25-minutes-nets-playoffs.Rmd
---
title: Minutes played by Nets, playoffs
layout: post
categories:
- posts
tags:
- nba, sports
output:
#html_document
md_document:
@bhoung
bhoung / 2021-06-19-nba-21-bbr.Rmd
Created Jun 27, 2021
R markdown notebooks accompanying yt screencast
View 2021-06-19-nba-21-bbr.Rmd
---
title: "Basketball Reference"
layout: post
categories:
- notebook
tags:
- nba, sports
output:
html_document
# md_document:
@bhoung
bhoung / 2021-06-17-nba-bbr.Rmd
Created Jun 19, 2021
'21 nets performance in games missed by stars r markdown
View 2021-06-17-nba-bbr.Rmd
---
title: "'21 Brooklyn Nets performance in games missed by stars"
layout: post
categories:
- notebook
tags:
- nba, sports
output:
html_document
# md_document:
View json_parser.hs
-- 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 / k-fold CV.r
Created Apr 24, 2014
starter code for k fold cross validation using the iris dataset
View k-fold CV.r
# 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
@bhoung
bhoung / time lapse.R
Created Jun 18, 2013
R code to create a map time lapse with ggplot and ffmpeg
View time lapse.R
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 / trueskill_ex2.r
Last active Sep 30, 2021
Example 2. Running trueskill algorithm on a tennis tournament.
View trueskill_ex2.r
# 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 / ggmap example.r
Last active Dec 14, 2015
using ggmap to create images of melbourne showing a small random sample of schools. A few different map types are shown.
View ggmap example.r
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 / analyzeSGP example.r
Last active Dec 13, 2015
generate growth and achievement plot
View analyzeSGP example.r
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")