주(state)별 시민 수 세기
카운티 개수를 세는 대신 특정 변수로 가중치를 두어 셀 수 있어요. 이번에는 각 주(state)의 시민 수를 구해 보겠습니다.
counties_selected <- counties %>%
select(county, region, state, population, citizens)
이 연습은 강의의 일부입니다
dplyr로 데이터 조작하기
연습 안내
citizens열을 기준으로 가중치를 두어 각 주의 카운티 수를 세고, 내림차순으로 정렬하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Find number of counties per state, weighted by citizens, sorted in descending order
counties_selected %>%
___