Learn R Programming

barrel (version 0.1.0)

ord_ellipse_group: 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"
)

Value

Data frame of ellipse coordinates with group label.

A data frame with ellipse coordinates and group label.

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.

Examples

Run this code
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")

Run the code above in your browser using DataLab