在尝试处理我似乎无法调试的数据时,我遇到了几个错误。
这是R脚本https://dl.dropbox.com/u/28231177/This%20Should%20Work.R
这是数据https://dl.dropbox.com/u/28231177/my_data.csv
这是我运行它们时包含错误的最后几行:
pds <- fortify(sf_map)
# Using OBJECTID to define regions.
pds$OBJECTID <- as.integer(pds$OBJECTID)
# Error in `$<-.data.frame`(`*tmp*`, "OBJECTID", value = integer(0)) :
# replacement has 0 rows, data has 16249
### Make the map
p1 <- ggplot(my_data, aes(map_id = zip))
p1 <- p1 + geom_map(aes(fill=vol, map_id = zip), map = pds)
p1 <- p1 + expand_limits(x = pds$lon, y = pds$lat) + coord_equal()
p1 + xlab("Basic Map with Default Elements")
# Error in unit(x, default.units) : 'x' and 'units' must have length > 0