[R-sig-Geo] classify a raster by unique value
Alfredo Alessandrini
alfreale74 at gmail.com
Tue Jul 12 15:41:47 CEST 2011
Hi,
I've a raster stack with 3 layers.
I need to classify it assigning one class to each unique combination of values.
> unique(as.matrix(data_stack))
layer_1 layer_2 layer_3
[1,] 0.2460000000 2 -0.1
[2,] 0.1845000000 2 -0.1
[3,] 0.0000000001 2 -0.1
[4,] 0.0000000001 2 0.0
[5,] 0.1476000000 2 -0.1
I must obtain a raster stack like this:
> unique(as.matrix(data_stack))
layer_1 layer_2 layer_3 class
[1,] 0.2460000000 2 -0.1 1
[2,] 0.1845000000 2 -0.1 2
[3,] 0.0000000001 2 -0.1 3
[4,] 0.0000000001 2 0.0 4
[5,] 0.1476000000 2 -0.1 5
Thanks in advance,
Alfredo
More information about the R-sig-Geo
mailing list