A more complicated spatial object
You probably noticed something a little different about the structure of countries_sp. It looked a lot like a list, but instead of the elements being proceeded by $ in the output they were instead proceeded by an @. This is because the sp classes are S4 objects, so instead of having elements they have slots and you access them with @. You'll learn more about this in the next video.
Right now, let's take a look at another object countries_spdf. It's a little more complicated than countries_sp, but you are now well-equipped to figure out how this object differs.
Take a look!
Este exercício faz parte do curso
Visualizing Geospatial Data in R
Instruções do exercício
- Call
summary()oncountries_spand then on this new objectcountries_spdf(one at a time). What kind of object is this? What differs between this andcountries_sp? - Call
str()withmax.level = 2oncountries_spdf. How does the structure differ fromcountries_sp? - Call
plot()oncountries_spdf.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Call summary() on countries_spdf and countries_sp
# Call str() with max.level = 2 on countries_spdf
# Plot countries_spdf