This function turns a map into a data frame.
# S3 method for map
tidy(x, ...)
map object
not used by this method
This code and documentation originated in ggplot2, but was called "fortify." In broom, "fortify" became "augment", which is reserved for functions that *add* columns to existing data (based on a model fit, for example) so these functions were renamed as "tidy."
# NOT RUN {
if (require("maps") && require("ggplot2")) {
ca <- map("county", "ca", plot = FALSE, fill = TRUE)
head(tidy(ca))
qplot(long, lat, data = ca, geom = "polygon", group = group)
tx <- map("county", "texas", plot = FALSE, fill = TRUE)
head(tidy(tx))
qplot(long, lat, data = tx, geom = "polygon", group = group,
colour = I("white"))
}
# }
Run the code above in your browser using DataLab