knitr::opts_chunk$set(fig.width = 8.83, message = FALSE, warning = FALSE) remotes::install_github("hrbrmstr/albersusa")
mapview can be used in piped expressions using %>%
, most likely at the very end of it...
Here are just a few examples of piped workflows:
plot
ting feature unionslibrary(mapview) library(poorman) library(leaflet) library(sf) # GitHub: hrbrmstr/albersusa library(albersusa) franconia %>% st_union %>% plot
mapview
ing feature unionsfranconia %>% st_union %>% mapview
franconia %>% group_by(district) %>% summarize %>% mapview(zcol = "district")
franconia %>% group_by(district) %>% summarize %>% mutate(area = as.numeric(st_area(.) / 1e6)) %>% mapview(zcol = "area")
franconia %>% mutate(area = as.numeric(st_area(.))) %>% mapview(zcol = "area", legend = TRUE)
breweries %>% st_intersection(franconia) %>% mapview(zcol = "district")
franconia %>% mutate(count = lengths(st_contains(., breweries))) %>% mapview(zcol = "count")
franconia %>% mutate(count = lengths(st_contains(., breweries)), density = count / as.numeric(st_area(.))) %>% mapview(zcol = "density")
native.crs
for a USA composite mapalbersusa::usa_composite("laea") %>% mapview(native.crs = TRUE, zcol = "pop_2014", legend = TRUE)
native.crs
albersusa::usa_composite("laea") %>% mapview(zcol = "pop_2014", legend = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.