Introduction to R and RStudioProject management in RStudioIntroduction to R
- Use RStudio to write and run R programs.
 - Use 
install.packages()to install packages. - Use 
library()to load packages. 
Data Structures
- The mostly used basic data types in R are 
numeric,integer,logical, andcharacter. - Use factors to represent categories in R.
 
Exploring Data Frames & Data frame Manipulation with dplyrExploring Data framesData frame Manipulation with dplyr
- We can use the 
select()andfilter()functions to select certain columns in a data frame and to subset it based a specific conditions. - With 
mutate(), we can create new columns in a data frame with values based on existing columns. - By combining 
group_by()andsummarize()in a pipe (|>) chain, we can generate summary statistics for each group in a data frame. 
Introduction to visualisationIntroduction to VisualisationWriting data
- With 
ggplot2, we use the+operator to combine plot layers and incrementally build a more complex plot. - In the aesthetics (
aes()), we can assign variables to the x and y axes and use thefillargument for colouring surfaces. - With 
scale_fill_viridis_c()andscale_fill_manual()we can assign new colours to our plot. - To open the help documentation for a function, we run the name of
the function preceded by the 
?sign. 
Introduction to Geospatial Concepts
Each location on the Earth has its geographical latitude and longitude, which can be transformed on a plane using a map projection.
Depending on the research question, we need a global, regional, or local CRS with suitable properties such as the least possible distortion and an appropriate measurement unit.
Open and Plot Vector Layers
- Metadata for vector layers include geometry type, CRS, and extent
and can be examined with the 
sffunctionsst_geometry_type(),st_crs(), andst_bbox(), respectively. - Load spatial objects into R with the 
sffunctionst_read(). - Spatial objects can be plotted directly with 
ggplot2using thegeom_sf()function. No need to convert to a data frame. 
Explore and plot by vector layer attributesQuery Vector Feature Metadata
Spatial objects in
sfare similar to standard data frames and can be manipulated using the same functions.Almost any feature of a plot can be customized using the various functions and options in the
ggplot2package.
Plot multiple shapefiles
- A plot can be a combination of multiple vector layers, each added
with a separate call to 
geom_sf(). - Use the 
scale_<aesthetic>_manual()functions to customise aesthetics of vector layers such ascolor,fill, andshape. 
Handling Spatial Projections & CRS
- 
ggplot2automatically converts all objects in a plot to the same CRS. - For geoprocessing purposes, you still need to reproject the layers you use to the same CRS.
 - You can export an 
sfobject to a shapefile withst_write(). 
Intro to Raster Data
- The GeoTIFF file format includes metadata about the raster data that
can be inspected with the 
describe()function from theterrapackage. - To plot raster data with the 
ggplot2package, we need to convert them to data frames. - PROJ is a widely used standard format to store, represent and transform CRS.
 - Histograms are useful to identify missing or bad data values.
 
Plot Raster Data
- Continuous data ranges can be grouped into categories using
mutate()andcut(). - Use the built-in 
terrain.colors()or set your preferred colour scheme manually. 
Reproject Raster Data
- In order to plot two raster data sets together, they must be in the same CRS.
 - Use the 
project()function to convert between CRSs. 
Raster Calculations
- Rasters can be computed on using mathematical functions.
 - The 
writeRaster()function can be used to write raster data to a file. 
Work with Multi-Band Rasters
- A single raster file can contain multiple bands or layers.
 - Use the 
rast()function to load all bands in a multi-layer raster file into R. - Individual bands within a SpatRaster can be accessed, analysed, and visualized using the same functions no matter how many bands it holds.
 
Import and Visualise OSM Data
- Use the 
NominatimandOverpassAPIs within R - Use the 
osmdatapackage to retrieve geospatial data - Select features and attributes among OSM tags
 - Use the 
ggplot,sfandleafletpackages to map data 
Basic GIS operations with R and sf
- Use the 
st_*functions fromsffor basic GIS operations - Perform unions, joins and intersection operations
 - Compute the area of spatial polygons with
st_area()