I have been playing around with different functions in R and I wanted to use the meanshift's msClustering()
function with my Raster data.
Following I have a reproducible example:
a<-matrix(data=sample(1:500,25),nrow = 5, ncol = 5)
b<-raster::raster(a)
raster::crs(b)<-"+init=epsg:4624"
c<-MeanShift::msClustering(a)
b$new<-c$components
and I get an error saying
1: In v[] <- value : number of items to replace is not a multiple of replacement length
which is logical given that they don't have the same length or dimensions.
So based on that example and error can anyone explain to me why I get a matrix of different dimension and give me a solution? Because I think my problem is more general and theoretical based on the classification method, rather than technical, so I figured it would be better to ask here.