1. Learn
  2. /
  3. Courses
  4. /
  5. Interactive Maps with leaflet in R

Exercise

Introduction to Spatial Data

We have been mapping points, but there are several spatial features that can be mapped, including polygons. In R, polygons are often stored in a SpatialPolygonsDataFrame that holds the polygon, coordinate information, and a data frame with one row per polygon.

A SpatialPolygonsDataFrame called shp that contains the zip code boundaries for North Carolina has been loaded for you. shp has five slots that store various types of information:

  1. data: data associated with each polygon
  2. polygons: coordinates to plot polygons
  3. plotOrder: order in which polygons are plotted
  4. bbox: bounding box for geographic data (i.e., a rectangle)
  5. proj4string: coordinate reference system

Let's take a closer look inside the shp object.

Instructions 1/3

undefined XP
  • 1

    Print the summary() of the shp data.

  • 2

    Print the class of shp.

  • 3

    Print the slot names of shp.