Wraps as_points()
, as_sfc()
, and sf_bbox_point()
to allow the
conversion of sf, sfc, or sfg objects into a simple data frame with X and Y
columns matching the provided nm parameter.
Usage
as_xy(x, bbox = NULL, crs = NULL, nm = c("x", "y"), ...)
Arguments
- x
A length 2 character string or numeric coordinate pair or a
sf
,sfc
, or abbox
object. If x is a character string (e.g. c("xmin", "ymax")), a sf, sfc, or bbox object must be provided to data argument.- bbox
A bbox object or object that can be converted with
as_bbox()
that is passed as bbox tosf_bbox_point()
when x is passed to the point parameter.- crs
A character or numeric reference to a coordinate reference system supported by
sf::st_crs()
or anothersf
,sfc
, orbbox
object that is used to provide crs.- nm
Column names to use for X and Y columns.
- ...
Additional parameters passed to
sf_bbox_point()
,as_points()
, oras_sfc()
.