Learn R Programming

broom (version 0.4.3)

tidy.map: Tidy method for map objects.

Description

This function turns a map into a data frame.

Usage

# S3 method for map
tidy(x, ...)

Arguments

x

map object

...

not used by this method

Details

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."

Examples

Run this code
# 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