## Code

`library(sf)`

`# Linking to GEOS 3.11.1, GDAL 3.6.2, PROJ 9.1.1; sf_use_s2() is TRUE`

The first part of this book introduces concepts of spatial data science: maps, projections, vector and raster data structures, software, attributes and support, and data cubes. This part uses R only to generate text output or figures. The R code for this is not shown or explained, as it would distract from the message: Part II focuses on the use of R. The online version of this book, found at https://r-spatial.org/book/ contains the R code at the place where it is used in hidden sections that can be unfolded on demand and copied to the clipboard for execution and experimenting. Output from R code uses code font and has lines starting with a `#`

, as in

`library(sf)`

`# Linking to GEOS 3.11.1, GDAL 3.6.2, PROJ 9.1.1; sf_use_s2() is TRUE`

Some of the code sections (e.g., in Chapter 6) contain code written to generate figures with R not relevant to the subject matter of the book. Code sections relevant to data analysis should be easy to follow when understanding R at the level of, say, R for Data Science (Wickham and Grolemund 2017).

More detailed explanation of R code to solve spatial data science problems starts in the second part of this book. Appendix B contains a short, elementary explanation of R data structures, Wickham (2014) gives a more extensive treatment on this.