Learn R Programming

terra (version 1.8-10)

scale_linear: Scale values linearly

Description

Linear scaling of raster cell values between a specified minimum and maximum value.

Usage

# S4 method for SpatRaster
scale_linear(x, min=0, max=1, filename="", ...)

Value

SpatRaster

Arguments

x

SpatRaster

min

minimum value to scale to

max

maximum value to scale to

filename

character. Output filename

...

additional arguments for writing files as in writeRaster

See Also

Examples

Run this code
r <- rast(system.file("ex/logo.tif", package="terra"))   
s1 <- scale_linear(r)
s2 <- scale_linear(r, 1, 10)

Run the code above in your browser using DataLab