I know that I can execute r.thin from GRASS GIS in the rgrass7 package, but I do not want to create a gis grass environment for this task. So are there other solutions in R?
For a small example, the desired output would be a black line:
library(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")
source
share