如何开始创建等值统计图
How to get started on creating choropleth map
手头的任务是将 empprevyearpct 值映射到县地图。示例数据如下。
library(tidyverse)
library(tigris)
countyname <- c("Carson City","Churchill County","Clark County","Douglas County","Elko County","Esmeralda County","Eureka County","Humboldt County","Lander County","Lincoln County","Lyon County","Mineral County","Nye County","Pershing County","Storey County","Washoe County","White Pine County")
prevyearpct <- c(.545,.541,.539,.401,.301,.201,.101,.001,.664,.604,.704,.123,.129,.130,.085,.015,.099)
data2 <- data.frame(countyname, prevyearpct)
这是我从 Tigris 获取形状文件时使用的代码。
NV_counties <- counties(32)
我不需要为我完成的工作。如果我要将 prevyearpct 值映射到县,我应该从哪里开始?我是否需要附加数据以便 NV_Counties 和 data2 成为一个合并项?我已经阅读了很多 articles/tutorials 但没有使用底格里斯河的内容。
你可以使用 geo_join()
to join the two datasets together. After that, you can use geom_sf()
to map it out (this guide 可能会有帮助)。
手头的任务是将 empprevyearpct 值映射到县地图。示例数据如下。
library(tidyverse)
library(tigris)
countyname <- c("Carson City","Churchill County","Clark County","Douglas County","Elko County","Esmeralda County","Eureka County","Humboldt County","Lander County","Lincoln County","Lyon County","Mineral County","Nye County","Pershing County","Storey County","Washoe County","White Pine County")
prevyearpct <- c(.545,.541,.539,.401,.301,.201,.101,.001,.664,.604,.704,.123,.129,.130,.085,.015,.099)
data2 <- data.frame(countyname, prevyearpct)
这是我从 Tigris 获取形状文件时使用的代码。
NV_counties <- counties(32)
我不需要为我完成的工作。如果我要将 prevyearpct 值映射到县,我应该从哪里开始?我是否需要附加数据以便 NV_Counties 和 data2 成为一个合并项?我已经阅读了很多 articles/tutorials 但没有使用底格里斯河的内容。
你可以使用 geo_join()
to join the two datasets together. After that, you can use geom_sf()
to map it out (this guide 可能会有帮助)。