Created
December 21, 2016 22:45
-
-
Save etiennebr/568021a59b0077fedc85da5444c13db2 to your computer and use it in GitHub Desktop.
sf in dplyr style
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dplyr style | |
polygons %>% | |
mutate(value = raster::extract.sfg(geometry, r, mean)) %>% | |
plot() | |
# sp style | |
value = raster::extract(polygons, r, mean, df = TRUE) | |
# multiple values | |
md <- function(x) data.frame(m = mean(x), d = sd(x) | |
polygons %>% | |
mutatem(value = raster::extract.sfg(geometry, r, md)) %>% | |
plot() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment