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

Uncounting observations

You've found the job of your dreams providing technical support for a dog breed beauty contest. The jury members want a spreadsheet with the breed and id of each participating dog so that they can add the scores later on. You've only been given the number of participants per dog breed (dog_df) so you decide to use your tidyr skills to create the desired result.

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

Reshaping Data with tidyr

ดูคอร์ส

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

  • Inspect the data in the console.
  • Uncount the data so that per breed, each dog gets a row and an ID. The ID should go in the dog_id column.

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

dog_df %>% 
  # Create one row for each participant and add the id
  ___
แก้ไขและรันโค้ด