描述性統計
本練習將示範如何從 abalone 資料集取得單一變數的簡單描述性統計,以及一次針對多個變數取得摘要統計。你會對單一變數使用 pull()、mean() 與 median() 函式;並使用 select() 與 summary() 來一次取得多個變數的摘要統計。
abalone 資料集與 dplyr 套件都已為你載入。
本練習屬於課程
給 SAS 使用者的 R
練習說明
- 使用
pull()與mean()兩個函式,求出鮑魚的平均 length。 - 使用
pull()與median()兩個函式,求出鮑魚的 whole weight 之中位數。 - 使用
select()與summary()兩個函式,取得 diameter 與 shell weight 的摘要統計。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# 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(___, ___) %>%
___