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

WHO obesity per country

According to the World Health Organization (WHO), worldwide obesity has nearly tripled since 1975. You're interested in the severity of this global health issue per country and whether males and females are affected differently. You'll use the WHO's obesity data (obesity_df) to investigate this issue. The data holds the percentage of females, males, and both sexes combined that are considered obese (BMI > 30) per country.

You want to create a scatterplot where, per nation, you can see the obesity data colored differently for females and males. This implies that sex should become a variable with its own column.

The ggplot2 package has been pre-loaded for you.

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

Reshaping Data with tidyr

ดูคอร์ส

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

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

obesity_df %>% 
  # Pivot the male and female columns
  pivot_longer(___)
แก้ไขและรันโค้ด