Learn R Programming

soilassessment (version 0.3.0)

reclassifyMap: A function for re-classifying raster maps based on input look-up table

Description

This function re-classifies an input raster maps based on input look-up table that specifies transition from map classes (or range of classes) to a new class (or range of classes)

Usage

reclassifyMap(fgrid,df)

Value

The output is a reclassified raster map

Arguments

fgrid

Input raster map to be reclassified

df

Input look-up table for re-classification

Author

Christian Thine Omuto

Details

The look-up table should have at least two columns in which the first column contains the classes in the input map and the second column contains the new classes to be assigned

References

Robert Hijman. Raster Package in R. https://www.rdocumentation.org/packages/raster

See Also

classCode, classLUT, classnames

Examples

Run this code
library(sp)
LUT=data.frame(map=c(1,2,3,4,5,6),new=c(100,20,30,40,60,80))
newmap=(suitabinput["depthcodes"])
newmap$depth=reclassifyMap(newmap["depthcodes"],LUT)
newmap$melon=depthSuit(newmap$depth,"melon")
summary(newmap$depth)
spplot(newmap["depth"])

Run the code above in your browser using DataLab