Substitute (replace) values in a RasterLayer with values in a data.frame. The data.frame should have a column to identify the key (ID) to match with the values of the RasterLayer, and a column with the replacement values. By default these are the first and second column but you can specify other columns with arguments by and which (see under Methods).
Usage
subs(x, y, ...)
Arguments
x
A RasterLayer object
y
A data.frame
...
Additional arguments. See under Methods
Value
A new RasterLayer object, and in some cases, the side effect of a new file on disk.
Details
You could obtain the same result with reclass, but subs is more efficient for simple replacement. Use reclass if you want to replace ranges of values with new values.
You can also replace values using a fitted model. E.g. fit a model to glm or loess and then call predict