View source: R/calc_functions.R
var_range | R Documentation |
Calculates the difference between the maximum and minimum value
var_range(x, ...)
## S3 method for class 'winmove'
var_range(x, d, type, na.rm = TRUE, ...)
## S3 method for class 'numeric'
var_range(x, na.rm = TRUE, ...)
x |
RasterLayer. The data over which to calculate the range size |
... |
further arguments passed to or from other methods |
d |
numeric. If |
type |
character. The shape of the moving window |
na.rm |
logical. indicates whether |
If class(x) == "winmove"
, a smoothed raster with the size of the range of values calculated within the specified
moving window
If class(x) == "numeric"
, a single value representing the size of the range of values in x
# load required data
data(cat_ls)
data(cont_ls)
# convert data to object of class winmove
cat_ls <- new("winmove", cat_ls)
# aggregate using a rectangular window with dimensions c(2,3)
d <- range(cont_ls, d = c(2,3), type = "rectangle")
# convert data to object of class numeric
cont_ls <- raster::values(cont_ls)
d <- range(cont_ls)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.