如何使用邮政编码数据集创建地图? (美国邮政编码)

How to create a map with zipcode dataset? ( US Zipcode )

How to create a map in R with zipcode dataset?

data <- c("22313","10100","25001") [邮政编码示例]

此刻,我有一个充满邮政编码的数据集,我想在地图上打印并以 pdf 格式保存。

此致,

E.P.

尝试使用我从 1 月起在 how do I map (on a geographical map) data in R just given the US Zipcodes 修改的以下代码:

pdf("myzipcodes.pdf")
library(maps)
map(database="usa")# national boundaries

library(zipcode)
data("zipcode")
myzips <- c("22313","83701","32301")
selected <- zipcode[ zipcode$zip %in% myzips, ]
points( selected$longitude, selected$latitude, pch= 19, cex= 2 )
text( selected$longitude, selected$latitude, selected$zip, pos=3, cex= 2 )
dev.off()

您提供了两个假邮政编码,所以我添加了几个真实的邮政编码。

在 RStudio 中,您还可以使用 'export' 菜单将绘图导出为 PDF 文件。