need a help to understand random forest sentences

Hey
I'm a beginner who just started to learn R and never lean any computer language before. I was just following some tutorials on website.
Currently, I'm studying species distribution using random forest, there're some sentences that I couldn't understand.

library(data.table)

avi_dat <- read.csv(file = "D:/species distribution tutorial/Data_SwissBreedingBirds.csv",
header = TRUE,
stringsAsFactors = FALSE)
summary(avi_dat)

avi_cols <- c('Turdus_torquatus', 'bio_5', 'bio_2', 'bio_14', 'std', 'rad', 'blockCV_tile')
avi_df <- data.frame(avi_dat)[avi_cols]

summary(avi_df)

library(raster)

bio_curr <- getData('worldclim', var='bio', res=0.5, lon=5.5, lat=45.5)[[c(2,5,14)]]
bio_fut <- getData('CMIP5', var='bio', res=0.5, lon=5.5, lat=45.5, rcp=45, model='NO', year=50, download=T)[[c(2,5,14)]]

until here, I understood how to download the data in R studio.

bg <- raster('/vsicurl/https://damariszurell.github.io/SDM-Intro/CH_mask.tif')
ch_ext <- c(5, 11, 45, 48)

the problem is from here.
why do I need the vector ch_ext?

bio_curr <- crop(bio_curr, ch_ext)

and how that vector can crop the raster brick? that doesn't exist before?

bio_curr <- projectRaster(bio_curr, bg)
bio_curr <- resample(bio_curr, bg)
bio_curr <- mask(bio_curr, bg)

names(bio_curr) <- c('bio_2', 'bio_5', 'bio_14')
bio_curr[[1]] <- bio_curr[[1]]/10
bio_curr[[2]] <- bio_curr[[2]]/10

those sentences are correct since I run it on R and had the same result that tutorial showed. I just want to know what are those sentences mean or why they are neccessary.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.