1

Create a matrix with 8 rows and 8 columns filles with random numbers in a range between 1 and 1000.
You can use the sample() function to create the numbers.

2

Now use this matrix to create a raster layer and plot it.
The raster() function can be fed with matrices to create a raster layer.

The raster() function can not only be used to create raster data on the fly, which is also not very interesting. Instead, we can use it to import already prepared data.

3

Import one of the raster .tiff files in the ./data/ folder of the workshop directory (repository). Do you get any warning messages?
Make sure your file paths are set correctly. You can check them with getwd(). Setting is done with setwd().

4

Import the data on Immigrants, Germans, and Inhabitants. Add up the Immigrants and Germans to a new layer. Then subtract this new layer from the Inhabitants layer to check whether the inhabitant layer is the same as the sum of immigrants and Germans. Is it?
You can handle raster layers as any simple data table using + and - operators.