countPoints | R Documentation |
Returns the number of points in a sf
or SpatVector
object. This is typically done using either length(x)
or nrow(x)
, depending on whether the object in question has rows or not. This function helps in ambiguous cases, so users need not care if nrow
or length
is needed.
countPoints(x, byFeature = FALSE)
x |
Object of class |
byFeature |
If |
Numeric.
library(sf)
# lemur occurrence data
data(lemurs)
wgs84 <- getCRS('WGS84')
occs <- lemurs[lemurs$species == 'Eulemur fulvus', ]
occs <- sf::st_as_sf(occs, coords=c('longitude', 'latitude'), crs=wgs84)
countPoints(occs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.