powered by
Convert a data.frame (or data.table) of occurrence records into a SpatVector object.
spatialize( occ, long = "decimalLongitude", lat = "decimalLatitude", crs = "epsg:4326", force_numeric = TRUE )
A SpatVector object containing the spatialized occurrence records.
(data.frame or data.table) a data frame containing the occurrence records to be flagged. Must contain columns for longitude, and latitude.
(character) the name of the column in occ that contains the longitude values. Default is "decimalLongitude".
occ
"decimalLongitude"
(character) the name of the column in occ that contains the latitude values. Default is "decimalLatitude".
"decimalLatitude"
(character) the coordinate reference system (see ?terra::crs). Default is "epsg:4326".
?terra::crs
(logical) whether to coerce the longitude and latitude columns to numeric if they are not already. Default is TRUE.
TRUE.
# Load example data data("occurrences", package = "RuHere") # Spatialize the occurrence records pts <- spatialize(occurrences) # Plot the resulting SpatVector terra::plot(pts)
Run the code above in your browser using DataLab