0

I am trying to use the clump function to identify clumps in this raster and I am getting the following error message:

Error in if (cls[i] == "character") { : 
  missing value where TRUE/FALSE needed

I have no idea what is going wrong. Does anyone have any ideas? Thanks very much.

Here's the rest of my code

library(raster)
library(igrid)

chng00_12 <- raster("change00_12.tif")

lossClumps <- clump(chng00_12,
                    filename='lossClumps.tif',
                    directions=8,
                    gaps=FALSE)
  • The answer might be here; [Error in if/while (condition) {: missing Value where TRUE/FALSE needed](https://stackoverflow.com/questions/7355187/error-in-if-while-condition-missing-value-where-true-false-needed) – ViviG Dec 15 '20 at 20:26
  • difficult to understand why this happens without the file. Can you make it available here (or to me via email)? – Robert Hijmans Dec 15 '20 at 22:06
  • @RobertHijmans it turns out something was going wrong in the `gaps=FALSE` argument. I thought that was what I needed but I actually didn't. I set gaps to true and it worked out fine. Thanks for the offer – Nadav Bendavid Dec 15 '20 at 23:25

0 Answers0