ord_ellipse_group: Compute Ellipse Coordinates for a Single Group

View source: R/2.ord_ellipse_group.R

ord_ellipse_groupR Documentation

Compute Ellipse Coordinates for a Single Group

Description

Calculates ellipse coordinates for one group in ordination scores with robust or classic covariance.

Usage

ord_ellipse_group(
  scores,
  group_var,
  group_name,
  axis1,
  axis2,
  kind = "se",
  conf = 0.95,
  method = "classic"
)

Arguments

scores

Data frame of ordination scores.

group_var

Name of grouping column.

group_name

Name of the group to calculate ellipse.

axis1

Name of first axis column.

axis2

Name of second axis column.

kind

Type of ellipse: "se" or "sd".

conf

Confidence level.

method

Covariance method: "classic" or "robust".

Details

Compute ellipse coordinates for a specific group in ordination scores

Calculates ellipse coordinates for one group from ordination scores, supporting classical or robust covariance estimation.

Value

Data frame of ellipse coordinates with group label.

A data frame with ellipse coordinates and group label.

Examples

library(vegan)
data(dune)
data(dune.env)
pca <- rda(dune, scale = TRUE)
scores <- as.data.frame(scores(pca, display = "sites"))
scores$Group <- dune.env$Management
ell <- ord_ellipse_group(scores, "Group", "BF", "PC1", "PC2", kind = "se", method = "classic")
plot(ell$PC1, ell$PC2, type = "l")


barrel documentation built on Nov. 5, 2025, 7:40 p.m.