LoslegenKostenlos loslegen

Exploring Spatial Data

The data slot in shp holds a data frame like we are used to working with. However, since it is stored inside a SpatialPolygonsDataFrame, we access the data frame a little differently using the @ operator.

glimpse(shp@data) 

Observations: 808
Variables: 2
$ GEOID10 <fct> 27925, 28754, 28092...
$ ALAND10 <fct> 624688620, 223734670, 317180853 ...

Our data frame has 808 observations of two variables:

  1. GEOID10: the zip code of each polygon
  2. ALAND10: the area (square meters) of each polygon

Diese Übung ist Teil des Kurses

Interactive Maps with leaflet in R

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Glimpse the data slot of shp
glimpse(shp___data)
Code bearbeiten und ausführen