Description Usage Arguments Value Examples
View source: R/FunctionCorrVars.R
Produce a correlation matrix of all potential input variables
1 2 |
vars |
A raster stack of potential input variables |
na.rm |
'logical' Should cells with at least one NA be ignored? |
order |
Ordering method for the correlation matrix plot. See '?corrplot::corrplot' for more details |
title |
Title for the correlation matrix plot |
A matrix of correlation coefficients between layers, and a correlation matrix plot of these coefficients
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #get UK extent
UK <- ggplot2::map_data(map = "world", region = "UK")
max.lat <- ceiling(max(UK$lat))
min.lat <- floor(min(UK$lat))
max.lon <- ceiling(max(UK$long))
min.lon <- floor(min(UK$long))
extent <- raster::extent(x = c(min.lon, max.lon, min.lat, max.lat))
#get variables data
bio<-raster::getData('worldclim',var='bio',res=5,lon=-2,lat=40)
#crop to uk
bio<-raster::crop(bio,extent)
#produce correlation matrix
corr <- corrVars(bio)
#END
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.