Description Usage Arguments Value See Also Examples

Reclassify values of a Raster* object. The function (re)classifies groups of values to other values. For example, all values between 1 and 10 become 1, and all values between 11 and 15 become 2 (see functions `subs`

and `cut`

for alternative approaches).

Reclassification is done with matrix `rcl`

, in the row order of the reclassify table. Thus, if there are overlapping ranges, the first time a number is within a range determines the reclassification value.

1 2 | ```
## S4 method for signature 'Raster'
reclassify(x, rcl, filename='', include.lowest=FALSE, right=TRUE, ...)
``` |

`x` |
Raster* object |

`rcl` |
matrix for reclassification. This matrix must have 3 columns. The first two columns are "from" "to" of the input values, and the third column "becomes" has the new value for that range. (You can also supply a vector that can be coerced into a n*3 matrix (with byrow=TRUE)). You can also provide a two column matrix ("is", "becomes") which can be useful for integer values. In that case, the |

`filename` |
character. Output filename (optional) |

`include.lowest` |
logical, indicating if a value equal to the lowest value in rcl (or highest value in the second column, for right = FALSE) should be included. The default is |

`right` |
logical, indicating if the intervals should be closed on the right (and open on the left) or vice versa. The default is |

`...` |
additional arguments as for |

Raster* object

1 2 3 4 5 6 7 8 9 10 | ```
r <- raster(ncols=36, nrows=18)
r[] <- runif(ncell(r))
# reclassify the values into three groups
# all values >= 0 and <= 0.25 become 1, etc.
m <- c(0, 0.25, 1, 0.25, 0.5, 2, 0.5, 1, 3)
rclmat <- matrix(m, ncol=3, byrow=TRUE)
rc <- reclassify(r, rclmat)
# equivalent to
rc <- reclassify(r, c(-Inf,0.25,1, 0.25,0.5,2, 0.5,Inf,3))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.