BaşlayınÜcretsiz Başlayın

Further down the rabbit hole

In the last exercise, the SpatialPolygonsDataFrame had a list of Polygons in its polygons slot, and each of those Polygons objects also had a Polygons slot. So, many polygons…but you aren't at the bottom of the hierarchy yet!

Let's take another look at the 169th element in the Polygons slot of countries_spdf. Run this code from the previous exercise:

one <- countries_spdf@polygons[[169]]
str(one, max.level = 2)

The Polygons slot has a list inside with 10 elements. What are these objects? Let's keep digging….

Bu egzersiz

Visualizing Geospatial Data in R

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Call str() with max.level = 2 on the Polygons slot of one.
  • Call str() with max.level = 2 on the 6th element of the Polygons slot of one. Do you see something that looks like it might be spatial data?
  • Call plot() on the coords slot of the 6th element of the Polygons slot of one. Do you recognise what data this object contains?

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

one <- countries_spdf@polygons[[169]]

# str() with max.level = 2, on the Polygons slot of one


# str() with max.level = 2, on the 6th element of the one@Polygons


# Call plot on the coords slot of 6th element of one@Polygons
Kodu Düzenle ve Çalıştır