-1

a raster file:

  library(terra)
  ff <- system.file("ex/elev.tif", package="terra")
  rasf<- rast(ff)
   rasf=rasf/100

I want to classify the values of rasf according to the best match with values of vec , using which.min

   vec=c(0.1, 1, 3.5, 6)

so for example a value of 0.2 in rasf will be replaced with 0.1 (because it close to 0.1), a value of 3 in rasf will be replaced with 3.5, etc

Tpellirn
  • 660
  • 4
  • 11

0 Answers0