Sometimes, we want to know the trends and behaviors of people in different countries or states. For example, we might want to see the shopping behaviors of people in different states. The maps package is useful for this purpose. In this section, we will look at how to draw and display information with maps.
Maps
Displaying Information with Maps
In this section, we'll create a map of the US and Europe that is colored according to lat, long, and group variables. Let's begin by implementing the following steps:
- Install the maps package using map_data to get a data frame for the different states' information, as follows:
states_map <- map_data("state")
glimpse(states_map)
## Observations: 15...