Let's take a look at a spatial object
We've loaded a particular sp object into your workspace: countries_sp. There are special print(), summary() and plot() methods for these objects. What's a method? It's a special version of a function that gets used based on the type of object you pass to it. It's common when a package creates new types of objects for it to contain methods for simple exploration and display.
In practice, this means you can call plot(countries_sp) and if there is a method for the class of countries_sp, it gets called. The print() method is the one called when you just type an object's name in the console.
Can you figure out what kind of object this countries_sp is? Can you see what coordinate system this spatial data uses? What does the data in the object describe?
Deze oefening maakt deel uit van de cursus
Visualizing Geospatial Data in R
Oefeninstructies
- Print
countries_sp. Why isn't this very useful?. - Call
summary()oncountries_sp. - Call
plot()oncountries_sp.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
library(sp)
# Print countries_sp
# Call summary() on countries_sp
# Call plot() on countries_sp