Guest User

Untitled

a guest
Dec 11th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. library(raster)
  2. library(sp)
  3.  
  4. r <- getData("worldclim",var="bio",res=10)
  5. r <- r[[c(1,12)]]
  6.  
  7. names(r) <- c("Temp","Prec")
  8.  
  9. lats <- c(48.45435)
  10. lons <- c(-2.04734)
  11.  
  12. coords <- data.frame(x=lons,y=lats)
  13. points <- SpatialPoints(coords, proj4string = r@crs)
  14. values <- extract(r,points)
  15. df <- cbind.data.frame(coordinates(points),values)
  16. df
Add Comment
Please, Sign In to add comment