開始使用免費開始

使用歷史 shapefile

為了與你將在下一章學到的 tidycensus 套件順利整合,tigris 的預設行為是回傳與最新發布的 ACS 資料年份相對應的 shapefile。不過,你有時可能需要其他年份的邊界檔。tigris 讓 R 使用者可以取得 1990、2000,以及 2010 到 2017 年的 shapefile,這些年份反映了許多邊界隨時間調整的情況。在本練習中,你會使用 tigris 來探索德州 Williamson 郡的 Census tract 邊界在 1990 年與 2016 年之間如何改變。

本練習屬於課程

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

檢視課程

練習說明

  • 取得 1990 年 Williamson 郡的 Census tract 資料集。
  • 再次取得 Williamson 郡的 Census tract 資料集,但這次是 2016 年。
  • 繪出兩個資料集的幾何圖形,並加以比較。

動手互動練習

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

# Get a historic Census tract shapefile from 1990 for Williamson County, Texas
williamson90 <- ___(___ = "TX", county = "Williamson", 
                       cb = TRUE, year = ___)

# Compare with a current dataset for 2016
williamson16 <- ___(state = "TX", ___ = "Williamson", 
                       cb = TRUE, year = ___)

# Plot the geometry to compare the results                       
par(mfrow = c(1, 2))
plot(williamson90$___)
plot(___$geometry)
編輯並執行程式碼