configStack: configStack

Description Usage Arguments Details Value Examples

View source: R/config_stack.R

Description

output config layers as rasterStack

Usage

1
configStack(env.stack, config)

Arguments

env.stack

a rasterStack object that contain the environment variable

config

config is a list or matrix or data.frame that contain config info, details see details part

Details

This method will extract rasterLayer acorrding to config, then output rasterStack as result

Value

rasterStack object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# load the sdmvspecies library
library("sdmvspecies")
library("raster")
# find package's location
package.dir <- system.file(package="sdmvspecies")
# let see where is our sdmvspecies is installed in
package.dir
# find env dir under the package's location
env.dir <- paste(package.dir, "/external/env/", sep="")
# let see env dir
env.dir
# get the environment raster file
env.files <- list.files(env.dir, pattern="*.bil$", full.names=TRUE)
# see the file list
env.files
# put the environment file in a raster stack,
# which require all the environment should have same resolution and extend
env.stack <- stack(env.files)
# let see the env.stack var
env.stack
# here let's configure the environment response function and weight
config <- list(c("bio1", "1", 0, 100), c("bio11", "2", -100, NULL))
env.stack <- configStack(env.stack, config)
plot(env.stack)

sdmvspecies documentation built on May 2, 2019, 5:11 a.m.