6

I know I could execute r.thin from GRASS GIS within the rgrass7 package, but I don't want to build up a grass gis environment, for this task. So are there other solutions in R?

Small example, desired output would be the black line:

library(raster)
#create synthetic raster
values<-c(1:10000)
r <- raster(ncol=100, nrow=100, xmn=0, xmx=100, ymn=0, ymx=100)
r[]<-0
r[]<-ifelse(values>4500 & values<5501,1,0)
plot(r)
lines(c(0,100),c(50,50),col="black")
burbot
  • 175
  • 1
  • 5

0 Answers0