Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tab6 <- as.data.frame(svytable(~orgs.pets+orgs_6, sdes)) #Give subgroup counts for orgs_6 within orgs.pets
- tab6
- #Adds percentages
- tab6 <- tab6 %>%
- group_by(orgs.pets) %>% #Creates subgroups for the first var...
- mutate(grpn = sum(Freq)) %>% #...then finds the sum for each subgroup
- mutate(grppct = Freq/grpn) #Then converts to percentage
- tab6$grppct <- round(tab6$grppct, 2)*100 #Makes percentages pretty
- tab6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement