開始使用免費開始

了解 tigris 物件的結構

tigris 預設會回傳 sp 套件中的 Spatial*DataFrame 類別物件。Spatial* 類別的物件以不同的 slots 來表示空間資料的各個組成部分,其中包含物件的幾何形狀、屬性,以及座標系統的描述。這個練習中,我們會簡單檢視 tigris 函式所回傳物件的結構。

本練習屬於課程

在 R 中分析美國人口普查資料

檢視課程

練習說明

  • 檢查 Colorado 郡(counties)物件的類別。
  • 檢視 Colorado 郡物件 data slot 的前幾列。
  • 檢查 co_counties 物件的座標系統,方法是查看 proj4string slot。

動手互動練習

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

# Check the class of the data
___(co_counties)

# Take a look at the information in the data slot
head(co_counties@___)

# Check the coordinate system of the data
___@proj4string
編輯並執行程式碼