Graphics Reference
In-Depth Information
Discussion
The
map_data()
function returns a data frame with the following columns:
long
long
Longitude.
lat
Latitude.
group
group
This is a grouping variable for each polygon. A region or subregion might have multiple poly-
gons, for example, if it includes islands.
order
order
The order to connect each point within a group.
region
region
Roughly, the names of countries, although some other objects are present (such as some
lakes).
subregion
subregion
The names of subregions within a region, which can contain multiple groups. For example,
the Alaska subregion includes many islands, each with its own group.
There are a number of different maps available, including
world
,
nz
,
france
,
italy
,
usa
(out-
line of the United States),
state
(each state in the USA), and
county
(each county in the USA).
For example, to get map data for the world:
# Get map data for world
world_map
<-
map_data(
"world"
)
world_map
long lat group order region subregion
-133.3664 58.42416
1
1
Canada
<
NA
>
-132.2681 57.16308
1
2
Canada
<
NA
>
-132.0498 56.98610
1
3
Canada
<
NA
>
...
124.7772 11.35419 2284 27634
Philippines Leyte
124.9697 11.30280 2284 27635
Philippines Leyte
125.0155 11.13887 2284 27636
Philippines Leyte