I'm working with a raster brick with 365 layers in R using the raster
package. I want to transform all values in the raster brick for pixel index r,c
from layer index start:stop
. I've figured out how to extract these values from the brick:
year_mask[[start:stop]][r,c]
...but when I try to assign a value to this subset of the raster brick, say by doing the following:
year_mask[[start:stop]][r,c] <- NA
..then I get the following error:
Error in v[] <- value :
incompatible types (from S4 to logical) in subassignment type fix
Any thoughts on how to assign a value or NA to a space-time index of a raster brick?