네 가지 동사 중에서 선택하기
이번 장에서는 네 가지 동사 select(), mutate(), relocate(), rename()에 대해 배웠어요. 여기서는 상황별로 알맞은 동사를 고르세요. 괄호 안의 내용은 바꿀 필요가 없어요.
이 연습은 강의의 일부입니다
dplyr로 데이터 조작하기
연습 안내
unemployment열 이름을unemployment_rate로 바꾸는 데 알맞은 동사를 고르세요.state,county열과poverty가 포함된 열만 남기기 위해 알맞은 동사를 고르세요.- 여성 인구 비율인
fraction_women이라는 새 열을 계산하되, 기존 열은 삭제하지 마세요. - 세 열만 남기세요:
state,county, 그리고employed / population을 계산해employment_rate라는 이름으로 저장하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Change the name of the unemployment column
counties %>%
___(unemployment_rate = unemployment)
# Keep the state and county columns, and the columns containing poverty
counties %>%
___(state, county, contains("poverty"))
# Calculate the fraction_women column without dropping the other columns
counties %>%
___(fraction_women = women / population)
# Move the region column to before state
counties %>%
___(region, .before = state)