Тренируюсь делать кластеризацию растра.
Код: Выделить всё
library(raster)
library(rgdal)
r_ndvi <- brick("/home/username/NDVI_VBU_08.tif")
Код: Выделить всё
ICE <- stack(r_ndvi)
plot(ICE)
Код: Выделить всё
ICE.df <- as.data.frame(ICE)
cluster.ICE <- kmeans(na.omit(ICE.df), 4)
Код: Выделить всё
clusters <- raster(ICE)
Код: Выделить всё
clusters <- setValues(clusters, cluster.ICE$cluster)
Код: Выделить всё
Ошибка в setValues(clusters, cluster.ICE$cluster) : length(values) is not equal to ncell(x), or to 1