normalize: Normalize data

View source: R/normalize.R

normalizeR Documentation

Normalize data

Description

Normalize numeric and raster data.

Usage

normalize(r, mn = NULL, mx = NULL, force_range = FALSE)

Arguments

r

SpatRaster or numeric vector.

mn

Numeric vector of length one. Minimum expected value. Default is equivalent to enter the minimum value from r.

mx

Numeric vector of length one. Maximum expected value. Default is equivalent to enter the maximum value from r.

force_range

Logical vector of length one. If it is TRUE, the range is forced to be between 0 and 1 by flattening values found below and above those limits.

Details

Normalize data laying between mn and mx to the range 0 to 1. Data greater than mx get values greater than 1 in a proportional fashion. Conversely, data less than mn get values less than 0.This function can be used for linear stretching of the histogram.

Value

An object from the same class as r with values from r linearly rescaled to make mn equal to zero and mx equal to one. Therefore, if mn and mx do not match the actual minimum and maximum from r, then the output will not cover the 0-to-1 range and may be outside that range if force_range is set to FALSE.

See Also

Other Pre-processing Functions: enhance_caim(), gbc(), local_fuzzy_thresholding(), membership_to_color()

Examples

normalize(read_caim())

rcaiman documentation built on Nov. 15, 2023, 1:08 a.m.