그룹 요약 연습하기
그룹 요약 결과와 함께 pivot_wider()를 사용할 수도 있어요.
이 연습은 강의의 일부입니다
R로 시작하는 텍스트 분석
연습 안내
tidy_twitter를 afinn 감성 사전에 결합하세요.- 불만 라벨과 사용자 인증 여부, 두 기준으로 그룹화하세요.
- 데이터를 요약해
aggregate_value라는 새 열을 만들고, 여기에value의 합계를 담으세요. complaint_label과aggregate_value열을 펼치세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
tidy_twitter %>%
# Append the afinn sentiment dictionary
___(___) %>%
# Group by both complaint label and whether or not the user is verified
___(___) %>%
# Summarize the data with an aggregate_value = sum(value)
___(___) %>%
# Spread the complaint_label and aggregate_value columns
___(___) %>%
mutate(overall_sentiment = Complaint + `Non-Complaint`)