開始使用免費開始

檢視層級

讓我們繼續加深對 CurrentJobTitleSelect 的理解。上一題我們取得了它有多少個層級,但另一個重點是這些層級到底是什麼。和上一題一樣,我們會用 pull 從資料集 responses_as_factors 取出 CurrentJobTitleSelect 的值。pull 可以和 $ 互換使用,從資料表中把某欄抓成向量。例如,mean(mtcars$mpg) 等同於 mean(mtcars %>% pull(mpg))mtcars %>% pull(mpg) %>% mean()

本練習屬於課程

Tidyverse 的類別資料

檢視課程

練習說明

  • 使用 pull() 取出 CurrentJobTitleSelect 欄位。
  • 取得層級的名稱。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

responses_as_factors %>%
    # Pull CurrentJobTitleSelect
    ___(CurrentJobTitleSelect) %>%
    # Get the values of the levels
    ___
編輯並執行程式碼