Lesson 3: Raster Data

Authors

Daniele Cannatella

Claudiu Forgaci

Ignacio Urria Yáñez

Episode 10: Intro to Raster Data

Videos Credits: Claudiu Forgaci, Ignacio Urria Yáñez

Starting from this episode, you’ll start to work with raster data in R.

Make sure that you have installed the necessary packages

Check that you have the terra package installed in your Rstudio environment.

Raster Script

Raster script review

Question about scripting

Is there a way to autosave the script without us having to remember to save it?

Raster Attribute

describe() function is introduced

Question about Raster Attribute

Can we use ‘here’?

Raster Attribute Pt.2

Open Raster in R

Import the raster data into R

Question about opening a raster file

Is the height based on the sea level?

Open a Raster in R Pt. 2

Using the rast() and summary() functions.

Question about raster summary

What are min and max numbers?

Open a Raster in R Pt. 3

plot and as.data

Tip: Close the copilot

Here’s how to close the copilot

Open a Raster in R Pt. 4

Common errors of uppercase and lowercase letters during the previous challenge

Question about putting marks in the argument

What would happen if we don’t put the strange marks for our fill argument?

Answer to the question

Open a Raster in R Pt. 5

View Raster CRS

Here’s how to view the raster coordinate reference system

Calculate Raster’s Minimum and Maximum Values

Here’s how to calculate your raster’s Min and Max values with minmax() function

Question about minmax

How does minmax work in terms of data structure?

Discussion regarding the minmax

Check the callout for data tip

Raster bands

Raster layers can contain several band layers of different values.

Challenge: Describe raster values

Challenge description

Challenge solution

Question about the challenge

Where can we find the information?

Episode 11: Plot Raster Data

Introduction to plotting the raster data

Make sure that you have installed the necessary packages

Check that you have the terra package installed in your Rstudio environment.

Plotting data using breaks

Using the cut() and mutate() functions

Question about using breaks

What columns does the data frame have now?

Plotting data using breaks Pt. 2

Plot Formatting

There are more plot formatting options, such as color_scale_fill_manual() function.

Plot Formatting Pt. 2

element_blank() and theme() functions are explained.

Tip and question about plot formatting

How to check documentation for the theme function?

Challenge: Plot using custom breaks

Challenge description

Challenge Solution

Question regarding the challenge

Can you cut the equal numbers of values?