# tlevine/quinoa-index

aoue

1 parent eff1be1 commit 8fce75790403f1cf9820cfda4645257a3c40a1ab committed Sep 19, 2012
Showing with 17 additions and 3 deletions.
1. +2 −2 analysis/munge/0-rename.R
2. +10 −0 analysis/munge/1-male-ratio.R
3. +1 −1 analysis/munge/3-zip.R
4. +4 −0 analysis/munge/5-group-and-join.R
4 analysis/munge/0-rename.R
 @@ -1,2 +1,2 @@ -yoga <- dumptruck -rm(dumptruck) +# yoga <- dumptruck +# rm(dumptruck)
10 analysis/munge/1-male-ratio.R
 @@ -0,0 +1,10 @@ +aff\$portion.female <- (function(){ + # Dunno what the difference is, so let's take a mean. + males.per.female <- mean(aff\$Males.per.100.females, aff\$Males.per.100.females.1)/100 + + # Then turn it into a proportion + portion.male <- males.per.female / (males.per.female + 1) + + # Return portion female for funzies. + 1 - portion.male +})()
2 analysis/munge/3-zip.R
 @@ -1,5 +1,5 @@ get.zip.code <- function(messy.zip) { - sub('[^0-9]*([0-9]{5}).*', '\\1', messey.zip) + sub('[^0-9]*([0-9]{5}).*', '\\1', messy.zip) } # Get the zip code
4 analysis/munge/5-group-and-join.R
 @@ -0,0 +1,4 @@ +aff.grouped <- ddply(aff, 'zip', function(df){ + pop <- sum(df\$Total.population) + +})