Skip to content

Instantly share code, notes, and snippets.

Avatar

Peter Green pitakakariki

  • Dunedin
View GitHub Profile
View gist:c5364a5024ff23fe5b4372a922c59ca7
X <- data.frame(g=c('a', 'a', 'a', 'b', 'b', 'b'), x=c(1:3, 1:3), y=c(3,0,1,4,0,0))
ggplot(X, aes(x, y, fill=g)) + geom_col(pos='dodge')
ggplot(subset(X, y!=0), aes(x, y, fill=g)) + geom_col(pos='dodge')
View nzpoll.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View nzpoll.R
###
##
## --- New Zealand General Election Polling ---
##
## Plots polling data scraped from Wikipedia.
##
## - GAM -
##
## The smoothed curves are calculated using a generalised additive model (GAM). The
## smoothing parameter is estimated using cross-validation. This means that the curves
View gist:3f543e7e1c038dc9070e
Decision No. 2015-087
Under The Broadcasting Act 1989
Between PETER GREEN
Complainant
And MEDIAWORKS RADIO LTD
Broadcaster
Before
Peter Radich, Chair
Te Raumawhitu Kupenga
Paula Rose
View gist:0804719b45c50251db44
BSA
W Under The Broadcastin Act 1989
BROADCASTING STANDARDS Aumqmrv Between PETER GREEN
TE MANA WHANONGA KAIPAHO
Complainant
And MEDIAWORKS TV LTD
Broadcaster
Before
Peter Radich, Chair
Leigh Pearson
View gist:4195637ba88af198f01b
f <- function(v=1000000, x=9, y=1) list(x=x, y=y, z=(v + 1000*(v %% 10)) %% 30323)
g <- function(x, y, z, rc) {
x <- (171 * x) %% 30269
y <- (172 * y) %% 30307
z <- (170 * z) %% 30323
rc <- ((10000 * x) %/% 30269) + ((10000 * y) %/% 30307) + ((10000 * x) %/% 30323)
@pitakakariki
pitakakariki / quote_test.r
Created Oct 18, 2012
Possible syntax highlighting bug.
View quote_test.r
x <- "\"Hello!\""
x <- '"Hello!"'
@pitakakariki
pitakakariki / gsi.R
Created Jul 25, 2012 — forked from dwinter/gsi.R
calculate gsi in R
View gsi.R
#calculate Cummings et al (2008) _gsi_ - a meaure of the exlusivity of a
#predefiend group of leaves in a phylogenetic tree
#example
#
# tr <- rtree(10)
# grp <- paste("t", 1:5, sep="")
# gsi(tr, grp)
@pitakakariki
pitakakariki / polls.r
Last active Aug 4, 2016
Code to generate an interactive SVG graph of NZ general election polling.
View polls.r
###
##
## --- New Zealand General Election Polling ---
##
## Plots polling data scraped from Wikipedia.
##
## - GAM -
##
## The smoothed curves are calculated using a generalised additive model (GAM). The
## smoothing parameter is estimated using cross-validation. This means that the curves
You can’t perform that action at this time.