'using the midwest dataset and making a nibble using tidy verse
using the midwest dataset I was able to answer my own question for making a tibble
Solution 1:[1]
I think you need to group by state and category, and remove those fields from summarise() try:
midwest %>%
select(state, category, poptotal, popdensity, percollege) %>%
filter(category=='LHR'| category== 'LAR') %>%
group_by(state, category) %>%
summarise(totalPopulation=sum(poptotal),
meanPopDensity=mean(popdensity),
propcollege=proportions(percollege))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | nogbad |