Hello I am giving here a reproduc example. I have three rasters and I stacked them. I want to replace any value above 50 by NA but I am getting an error:
r <- raster(nrows=10, ncols=10)
r <- setValues(r, 1:ncell(r))
r1 <- raster(nrows=10, ncols=10)
r1 <- setValues(r1, 1:ncell(r))
r2 <- raster(nrows=10, ncols=10)
r2 <- setValues(r2, 1:ncell(r))
St=stack(r,r1,r2)
NAvalue(St) <- >50
Error: unexpected '>=' in "NAvalue(St) = >="
Any help?Thanks
> St[9,9]
layer.1 layer.2 layer.3
[1,] 89 89 89
> St[St >50] <- NA
> St[9,9]
layer.1 layer.2 layer.3
[1,] NA NA NA