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

ฝึกใช้งาน grouped summaries

เราสามารถใช้ pivot_wider() ร่วมกับผลลัพธ์จาก grouped summaries ได้เช่นกัน

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

การวิเคราะห์ข้อความเบื้องต้นใน R

ดูคอร์ส

คำแนะนำการฝึกหัด

  • เชื่อม tidy_twitter เข้ากับพจนานุกรม sentiment แบบ afinn
  • จัดกลุ่มตาม complaint label และสถานะการยืนยันตัวตนของผู้ใช้
  • สรุปข้อมูลโดยสร้างคอลัมน์ใหม่ชื่อ 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`)
แก้ไขและรันโค้ด