as_points | R Documentation |
as_points
is a convenience function which accepts as input a dataframe
with X/Y coordinates (in meters), assumed to come from the coordinate
reference system (CRS)
'Belge 1972 / Belgian Lambert 72' (EPSG 31370).
It converts the dataframe into an sf
points object in the same CRS.
as_points(df, xvar = "x", yvar = "y", remove = FALSE, warn_dupl = TRUE)
df |
A dataframe with X and Y coordinates in meters, assumed to be in the Belgian Lambert 72 CRS (EPSG-code 31370). |
xvar |
String. The X coordinate variable name. Defaults to |
yvar |
String. The Y coordinate variable name. Defaults to |
remove |
Logical. Should the X and Y coordinates be removed from the dataframe after conversion to a spatial object? |
warn_dupl |
Logical.
Defaults to |
As locations in Watina are typically defined by their X/Y coordinates,
this function eases the conversion to spatial data.
To later remove all spatial information from the result, you can use
sf::st_drop_geometry()
.
An sf
object of geometry type POINT
with EPSG-code
31370 as coordinate reference system.
library(tibble)
mydata <-
tibble(
a = runif(5),
x = rnorm(5, 155763, 5),
y = rnorm(5, 132693, 5)
)
as_points(mydata)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.