This will search around the pixels on rstLCC that have classesToReplace, and search in iteratively increasing radii outwards for other Land Cover Classes than the those indicated in classesToReplace. .

convertUnwantedLCC2(
  classesToReplace = 34:36,
  rstLCC,
  nIterations = 6,
  defaultNewValue = NA,
  invalidClasses = NA
)

Arguments

classesToReplace

Integer vector of classes that are are to be replaced, e.g., 34, 35, 36 on LCC2005, which are burned young, burned 10 year, and cities.

rstLCC

raster of land-cover class, e.g., LCC2005

nIterations

the number of iterations to perform

defaultNewValue

the value to assign a pixel in classesToReplace if no valid pixel is closer after nIterations

invalidClasses

classes that are not valid options

Value

A rasterLayer with values in classesToReplace converted to adjacent values or NA.

Author

Eliot McIntire Ian Eddy