With your example,

r <- raster(ncol=3, nrow=3)
r[] <- 1:ncell(r)
#a vector of cells I want to select
vals<-c(2,4,6)
plot(r)
values(r) <- ifelse(values(r) %in% vals, 1, NA)
dev.new()
plot(r)

Arnaud

	[[alternative HTML version deleted]]

