Compute the area covered by polygons
Usage
# S4 method for class 'giottoPolygon'
area(x, ...)
# S4 method for class 'SpatVector'
area(x, ...)Arguments
- x
giottoPolygon- ...
Arguments passed on to
terra::expanse
Details
Giotto's methods do not hook into terra's area() generic. This is because
area() in terra is deprecated in favor of expanse(). Additionally,
Giotto suppresses warnings about unrecognized CRS, which are currently not
as relevant for biological data.
Examples
sl <- GiottoData::loadSubObjectMini("spatLocsObj")
gpoly <- GiottoData::loadSubObjectMini("giottoPolygon")
gpoints <- GiottoData::loadSubObjectMini("giottoPoints")
# area of polygons
head(area(gpoly))
#> [1] 115.38216 137.69959 56.25879 40.22940 97.00258 45.33285
# area of the convex hull
area(hull(sl))
#> [1] 199333.6
feature_hulls <- hull(gpoints, by = "feat_ID")
head(area(feature_hulls))
#> [1] 144798.7 187046.0 188143.6 210427.2 180407.1 179525.7
