開始使用免費開始

載入外部資料集

在這個練習中,你會使用 readr 套件的 read_csv() 函式讀取 CSV(逗號分隔值)格式的 abalone.csv 資料集。你需要先載入 readr 套件。abalone.csv 資料集共有 4177 列與 9 欄,包含鮑魚的性別、尺寸與重量測量。想進一步了解 abalone.csv 資料集

本練習屬於課程

給 SAS 使用者的 R

檢視課程

練習說明

  • 使用 library(packagename) 函式載入 readr 套件。
  • 使用 readr 套件的 read_csv() 匯入資料集,將輸出以指定運算子 <- 指派給名為 abalone 的物件,建立資料集物件。
  • 使用 dim() 函式檢查 abalone 資料集的列數與欄數是否正確。
  • 列出 abalone 資料集中的變數名稱。

動手互動練習

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

# Load the readr package
library(___)

# Load abalone.csv dataset assign output to abalone
abalone <- readr::read_csv(___)

# Get the dimensions of the abalone dataset object
___

# Get variable names in the abalone dataset object
___
編輯並執行程式碼