knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
sfhelpers
is a R package including functions helping to run routines related
primarily to simple features
(sf
)
, but also to spatial objects of
other classes / packages (
stars
,
terra
).
sfhelpers
is motivated by multiple requests for code or advice related to sf
.
By publishing sfhelpers
I hope to at least partly satisfy these demands. sfhelpers
is still very much in the development phase; it may or may not go
any further. Suggestions are welcome.
# install package remotes if not yet installed # install.packages("remotes") # install fast from GitHub without vignettes (not recommended) # remotes::install_github("a-benini/sfhelpers") # recommended: installation from GitHub including vignettes: remotes::install_github( "a-benini/sfhelpers", build_vignettes = TRUE, dependencies = TRUE )
library(sfhelpers)
sfhelpers::st_or()
is a sf
equivalent of QGIS Union. st_or()
returns a geometry set containing overlapping and non-overlapping parts of two input sf
objects (or sfc
s).
library(sf) library(sfhelpers) # the two included demo sf-objects have partly identically named attribute columns st_agr(poly_1) st_agr(poly_2) # st_or() suffixes by default originally identically named attribute columns st_or(x = poly_1, y = poly_2) %>% st_drop_geometry() st_or(poly_1, poly_2) %>% plot()
For the rest of the functions included in sfhelpers
see here.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.