get_environment_layers: get_environment_layers

Description Usage Arguments Value Examples

Description

get_environment_layers draws environmental layers from WorldClim. It takes in a resolution value and draws monthly environment data from WorldClim.

Usage

1
get_environment_layers(resolution = 10)

Arguments

resolution

the spatial resolution of environmental layers (10, 5, or 2.5 (arc min))

Value

a list of environment raster stack corresponding to environment conditions in each month

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# plot mean temperatures throughout the year

par(mfrow=c(1, 4))
environment_data <- get_environment_layers()
tmeans <- stack()
max_range <- c(0,0)
for (i in 1:12) {
  tmeans <- stack(tmeans, environment_data[[i]][[1]])
  max_range <- range(max_range, range(getValues(environment_data[[i]][[1]]), na.rm=T))
}
plot(tmeans, breaks=seq(from=min(max_range), to=max(max_range), length.out=100), 
     col=rev(terrain.colors(99)), legend=F)
plot(tmeans, legend.only=T, 
     breaks=seq(from=min(max_range), to=max(max_range), length.out=100),
     col=rev(terrain.colors(99)),
     axis.args=list(at=seq(max_range[1], max_range[2], length.out=5),
                    labels=round(seq(max_range[1], max_range[2], length.out=5),3),
                    cex.axis=0.6))


# plot environment conditions (mean temperature, min temperature, max temperature and precipitation) for June
plot(environment_data[[6]])

elaineliu5/DVM documentation built on May 16, 2019, 2:57 a.m.