grainchanger (version 0.2.0)

var_range: Size of range of values

Description

Calculates the difference between the maximum and minimum value

Usage

var_range(x, ...)

# S3 method for winmove var_range(x, d, type, na.rm = TRUE, ...)

# S3 method for numeric var_range(x, na.rm = TRUE, ...)

Arguments

x

RasterLayer. The data over which to calculate the range size

...

further arguments passed to or from other methods

d

numeric. If type=circle, the radius of the circle (in units of the CRS). If type=rectangle the dimension of the rectangle (one or two numbers)

type

character. The shape of the moving window

na.rm

logical. indicates whether NA values should be stripped before the computation proceeds. na.rm = TRUE is the default

Value

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

Examples

Run this code
# NOT RUN {
# 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)

# }

Run the code above in your browser using DataCamp Workspace