Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. tab6 <- as.data.frame(svytable(~orgs.pets+orgs_6, sdes)) #Give subgroup counts for orgs_6 within orgs.pets
  2. tab6
  3.  
  4. #Adds percentages
  5. tab6 <- tab6 %>%
  6. group_by(orgs.pets) %>% #Creates subgroups for the first var...
  7. mutate(grpn = sum(Freq)) %>% #...then finds the sum for each subgroup
  8. mutate(grppct = Freq/grpn) #Then converts to percentage
  9. tab6$grppct <- round(tab6$grppct, 2)*100 #Makes percentages pretty
  10. tab6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement