Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(raster)
- library(sp)
- r <- getData("worldclim",var="bio",res=10)
- r <- r[[c(1,12)]]
- names(r) <- c("Temp","Prec")
- lats <- c(48.45435)
- lons <- c(-2.04734)
- coords <- data.frame(x=lons,y=lats)
- points <- SpatialPoints(coords, proj4string = r@crs)
- values <- extract(r,points)
- df <- cbind.data.frame(coordinates(points),values)
- df
Add Comment
Please, Sign In to add comment