Permalink
Browse files

munging

  • Loading branch information...
1 parent b096aa3 commit b4ffc8e1d80f861c41ad1ef26cf2e0ec4a0f38b4 @tlevine committed Sep 20, 2012
Showing with 4 additions and 7 deletions.
  1. +1 −7 analysis/munge/5-group.R
  2. +1 −0 analysis/munge/7-join.R
  3. +1 −0 analysis/munge/8-combine.R
  4. +1 −0 analysis/munge/9-present.R
@@ -17,11 +17,5 @@ aff.grouped <- ddply(aff, 'zip', function(df){
})
yoga.grouped <- ddply(yoga, 'zip', function(df){
- yoga.teachers <- nrow(df)
-
- if (is.na(yoga.teachers)) {
- 0
- } else {
- yoga.teachers
- }
+ c(yoga.teachers = nrow(df))
})
@@ -1 +1,2 @@
quinoa <- join(aff.grouped, yoga.grouped, by = 'zip')
+quinoa$yoga.teachers[is.na(quinoa$yoga.teachers)] <- 0
@@ -0,0 +1 @@
+quinoa$yoga.teachers.per.capita <- quinoa$yoga.teachers / quinoa$pop
@@ -0,0 +1 @@
+yoga.top.100 <- quinoa[order(quinoa$yoga.teachers.per.capita, decreasing = T),][1:100,]

0 comments on commit b4ffc8e

Please sign in to comment.