I need to perform Pearson pair correlation between 19 raster layers for the continents of Africa extracted from the WordClim database. I want to check which levels of variables are more correlated / significant for my model. To do this, I tried to use the layerStats function from the raster package, but after execution, my output does not contain numeric values, all rows and columns displayed NA values. Below is my script.
rastFiles<- list.files(pattern="bil")
a<-stack(rastFiles)
newext<-c(-20, 55, -35, 45)
Africa<-crop(a,newext)
Africa
cor<-layerStats(Africa,'pearson')
source
share