locs2vect | R Documentation |
Convert matrix or data frame with point coordinates to a SpatVector object
locs2vect(locs, crs = 4326, lon.col = NULL, lat.col = NULL)
locs |
A matrix or data frame containing point coordinates data.
If a matrix, the first two columns will be assumed to contain longitude
and latitude coordinates, respectively.
If a data frame, the function will try to guess the columns containing the coordinates
based on column names, unless |
crs |
A number specifying the EPSG code (see https://spatialreference.org). Default is geographic (unprojected) coordinates, datum WGS84 (EPSG = 4326). |
lon.col |
Character (optional). Name of the column containing longitude data. |
lat.col |
Character (optional). Name of the column containing latitude data. |
A terra::SpatVector()
object.
locs <- matrix(runif(20), ncol = 2)
locs2vect(locs)
locs <- data.frame(species = rep("Laurus nobilis", 10), x = runif(10), y = runif(10))
locs2vect(locs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.