เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

ความนิยมเชิงบวก-ลบด้วย Bing แบบ tidy: Call me Ishmael (พร้อม ggplot2)!

แบบฝึกหัดสุดท้ายของ Bing lexicon! ในแบบฝึกหัดนี้ จะใช้ pipe operator (%>%) เพื่อสร้าง timeline ของความรู้สึก (sentiment) ในเรื่อง Moby Dick ในตอนท้าย จะสร้างกราฟอย่างง่ายตามโครงสร้างโค้ดด้านล่าง บทถัดไปจะเจาะลึกเรื่องการสร้างกราฟมากขึ้น

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,]
แก้ไขและรันโค้ด