Learn R Programming

shipunov (version 1.17.1)

Squares: Areas of polygons

Description

Calculates areas of polygons

Usage

Squares(ppts, relative=FALSE)

Value

Numerical (possibly named) vector of polygon areas, one element per polygon.

Arguments

ppts

Output from Hulls() or Ellipses(), or just a list of polygons

relative

Calculate relative squares?

Author

Alexey Shipunov

Details

"List of polygons" must be the list which contains any number of two-column numerical matrices of data frames, each represents the vertices of one polygon.

Might be useful to understand the variability of groups.

See Also

Hulls, Ellipses

Examples

Run this code

iris.pca <- prcomp(iris[, -5])
iris.p <- iris.pca$x[, 1:2]

iris.h <- Hulls(iris.p[, 1:2], as.numeric(iris[, 5]), plot=FALSE)
Squares(iris.h, relative=TRUE)

iris.e <- Ellipses(iris.p, iris$Species, plot=FALSE, centers=TRUE)
Squares(iris.e)

Run the code above in your browser using DataLab