Skip to content
Browse files

aoue

  • Loading branch information...
1 parent eff1be1 commit 8fce75790403f1cf9820cfda4645257a3c40a1ab @tlevine 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
View
4 analysis/munge/0-rename.R
@@ -1,2 +1,2 @@
-yoga <- dumptruck
-rm(dumptruck)
+# yoga <- dumptruck
+# rm(dumptruck)
View
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
+})()
View
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
View
4 analysis/munge/5-group-and-join.R
@@ -0,0 +1,4 @@
+aff.grouped <- ddply(aff, 'zip', function(df){
+ pop <- sum(df$Total.population)
+
+})

0 comments on commit 8fce757

Please sign in to comment.
Something went wrong with that request. Please try again.