See example below.

rast<- raster(nrows=10, ncols=10)
rast[1:20] <- 3
rast[21:25] <- 9
rast[26:40] <- 2
rast[40:50] <- 7
rast[51:100] <- 1
plot(rast)
values(rast) <- ifelse(values(rast) %in% c(9,7), 1, NA) # just replace
c(9,7) by your vector
dev.new()
plot(rast)

Arnaud

	[[alternative HTML version deleted]]

