Skip to content

Instantly share code, notes, and snippets.

@zross
Created April 20, 2017 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zross/c804d3e3b9f6cbde0e5b63f7816400f1 to your computer and use it in GitHub Desktop.
Save zross/c804d3e3b9f6cbde0e5b63f7816400f1 to your computer and use it in GitHub Desktop.
quick example of sf with dplyr producing spatial output
library(dplyr)
nc = st_read(system.file("shape/nc.shp", package="sf"))
nc$blah <- sample(c(1,2,3), size = nrow(nc), replace = TRUE)
nc %>% group_by(blah) %>% summarize(avg_bir74 = mean(BIR74))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment