Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(raster)
- r <- raster(nrows=3,ncols=2,xmn=0,xmx=2,ymn=0,ymx=3,vals=1:6)
- colors <- c('red','orange','yellow','green','blue','purple')
- plot(r,col=colors)
- r1 <- crop(r,extent(c(0.5,1.5,0.5,1.5)))
- plot(r1,col=colors)
- > values(r)
- [1] 1 2 3 4 5 6
- > values(r1)
- [1] 3 4 5 6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement