Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. library(raster)
  2. r <- raster(nrows=3,ncols=2,xmn=0,xmx=2,ymn=0,ymx=3,vals=1:6)
  3. colors <- c('red','orange','yellow','green','blue','purple')
  4. plot(r,col=colors)
  5.  
  6. r1 <- crop(r,extent(c(0.5,1.5,0.5,1.5)))
  7. plot(r1,col=colors)
  8.  
  9. > values(r)
  10. [1] 1 2 3 4 5 6
  11. > values(r1)
  12. [1] 3 4 5 6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement