npts: count the number of points/vertices/nodes of sf objects

View source: R/sf.R

nptsR Documentation

count the number of points/vertices/nodes of sf objects

Description

count the number of points/vertices/nodes of sf objects

Usage

npts(x, by_feature = FALSE)

Arguments

x

an sf/sfc object

by_feature

count total number of vertices (FALSE) of for each feature (TRUE).

Note

currently only works for *POINTS, *LINES and *POLYGONS (not GEOMETRYCOLLECTION).

Examples

npts(franconia)
npts(franconia, by_feature = TRUE)
npts(sf::st_geometry(franconia[1, ])) # first polygon

npts(breweries) # is the same as
nrow(breweries)


environmentalinformatics-marburg/mapview documentation built on April 18, 2024, 4:40 p.m.