[Solved] How to create a map with zipcode dataset? ( US Zipcode ) [closed]


Try the following code which I modified from January at 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()

You provided two phony zip codes so I added a couple real ones.

In RStudio you can also export a plot as a PDF file using the ‘export’ menu.

solved How to create a map with zipcode dataset? ( US Zipcode ) [closed]