Bing 감성 극성 분석: 모비 딕 (ggplot2 활용)!
Bing 어휘 사전을 활용한 마지막 연습 문제입니다! 이번 연습 문제에서는 파이프 연산자(%>%)를 사용해 모비 딕의 감성 변화를 시간 순으로 살펴봅니다.
마지막에는 아래 코드 구조를 참고하여 간단한 시각화를 만들어 보겠습니다. 시각화에 대한 자세한 내용은 다음 챕터에서 다룹니다.
ggplot(pivoted_data, aes(index_column, polarity_column)) +
geom_smooth(se = FALSE)
이 연습은 강의의 일부입니다
R을 활용한 감성 분석
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
moby_polarity <- moby %>%
# Inner join to lexicon
___(bing, by = c("___" = "___")) %>%
# Count the sentiment scores
___(___, ___) %>%
# Pivot the sentiment into positive and negative columns
___(names_from = ___, values_from = ___, values_fill = ___) %>%
# Add polarity column
mutate(___ = ___ - __) %>% arrange(index)
# Examine a portion
moby_polarity[190:195,]