Skip to content

Instantly share code, notes, and snippets.

Avatar

James Curley jalapic

View GitHub Profile
View austin_trees.csv
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 9.
"id","address","description","species","diameter"
"819539","1307 HILLSIDE AVENUE","Remove dead 21 inch Live Oak in the ROW.","Oak",21
"757396","6201 GLEN MEADOW DRIVE","Remove Arizona Ash in Front Yard at 6201 Glen Meadow.","Arizona Ash",28
"785768","2614 DELWOOD PLACE","remove fallen post oak backyard","Oak",28
"733765","1109 FLANAGAN COVE","Remove 25"" Hackberry","Hackberry",25
"768887","1000 WISTERIA CIRCLE","Full of cavities and in decline, fall hazard","Arizona Ash",35
"773451","11776 JOLLYVILLE ROAD","Cedar elm in parking lot is hollow at the base creating a hazardous situation. The tree is also suffering from girdling roots, canopy decline, an unbalanced crown, borer damage, and mistletoe infection. Tree is recommended for removal due to void beneath tree and lower stem decay.","Cedar Elm",23
"746882","3801-1/2 EMMA BROWNING AVENUE","Remove dead tree / species unknown","Hackberry",12
"718921","2912 CHERRY LANE","URGENT! Remove protected sized cedar elm that is currently leaning and is a hazard. Tree i
View deadsix.txt
EURIPI
HEARIE
IDEATA
AEDINE
DEAWIE
EOCENE
FINITO
VEGETE
PEREIA
ACULEI
View half box
### Making half box/half point plot
# somewhat hackish solution to:
# https://twitter.com/EamonCaddigan/status/646759751242620928
# based mostly on copy/pasting from ggplot2 geom_violin source:
# https://github.com/hadley/ggplot2/blob/master/R/geom-violin.r
library(ggplot2)
library(dplyr)
View tiger_pga
library(tidyverse)
library(magrittr)
library(rvest)
webpage <- read_html("https://en.wikipedia.org/wiki/List_of_tournament_performances_by_Tiger_Woods")
l <- webpage %>% html_nodes("table.wikitable") %>% html_table()
@jalapic
jalapic / gist:a3ae8d96684efe847bfddeee1a256b85
Created Dec 30, 2018
17 consonants out of scrabble tile distribution
View gist:a3ae8d96684efe847bfddeee1a256b85
## Drawing consonants in a row
tiles <- c(rep("V", 44), rep("C", 56)) # 42 vowels + 2 blanks, 56 consonants
# combined vowels and blanks into "V" as don't care about difference for this
# loop 1 million times
res<-NULL
for(i in 1:1000000){
draw <- sample(tiles, 17, F)
View gist:e9ede23a3849c2d012690842e98f09cc
library(engsoccerdata)
library(tidyverse)
england %>%
filter(tier==1) %>%
split(.$Season) %>%
map(function(x) maketable_eng(x, Season = x$Season[1], tier=1, penalties=T) ) %>%
map(~summarise(., diff = Pts[Pos==1] - Pts[Pos==2])) %>%
bind_rows %>%
ggplot(aes(x=diff))+geom_histogram(color='black', fill="gray62", binwidth = 1) + scale_x_continuous(breaks = seq(0,20,2)) +
@jalapic
jalapic / lifeExp.csv
Created Feb 7, 2018
Life Expectancy in 2007
View lifeExp.csv
country lifeExp
Afghanistan 43.828
Albania 76.423
Algeria 72.301
Angola 42.731
Argentina 75.32
Australia 81.235
Austria 79.829
Bahrain 75.635
Bangladesh 64.062
@jalapic
jalapic / gist:bb5223a74c95a1e2478c607cf19c6773
Created May 21, 2017
6 goals in consecutive away games
View gist:bb5223a74c95a1e2478c607cf19c6773
library(tidyverse)
library(engsoccerdata)
england %>%
filter(tier==1) %>%
homeaway() %>%
group_by(team) %>%
arrange(Date) %>%
filter(venue=="away") %>%
mutate(gameno = row_number())%>%
@jalapic
jalapic / .block
Last active Apr 14, 2017
Stretched Chord Diagram - From educations to occupations
View .block
license: mit
View gist:77ca484acdf86752700fe1eb86219000
### Comparing Arsenal Points per N games over time
library(engsoccerdata)
library(tidyverse)
rollpts <- function(teamname=NULL, N=10){
rbind(england,england_current()) %>%
homeaway() %>%
filter(team==teamname) %>%
mutate(pts = ifelse(gf>ga, 3, ifelse(gf<ga, 0, 1)),