Descriptive statistics
This exercise will cover how to get simple descriptive statistics for individual variables from the abalone dataset and for multiple variables at once. You will use the functions pull(), mean() and median() for single variables and select() and summary() to get summary statistics on multiple variables at once.
The abalone dataset and dplyr package are already loaded for you.
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
R For SAS Users
คำแนะนำการฝึกหัด
- Find the mean length of the abalones using both the
pull()andmean()functions. - Find the median whole weight of the abalones using both the
pull()andmedian()functions. - Get summary statistics of diameter and shell weight using the
select()andsummary()functions.
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# Find mean length of abalones using pull() and mean()
abalone %>%
pull(___) %>%
mean()
# Find the median wholeWeight of the abalones
___ %>%
___ %>%
___
# Get descriptive statistics of diameter and shellWeight
___ %>%
select(___, ___) %>%
___