perform_ammi_single_trait: Perform AMMI Analysis for a Single Trait

View source: R/ammi_analysis.R

perform_ammi_single_traitR Documentation

Perform AMMI Analysis for a Single Trait

Description

This function performs Additive Main Effects and Multiplicative Interaction (AMMI) analysis for a single trait to evaluate genotype x environment interactions. It generates biplots and PC1 vs. Trait visualizations without relying on predictions.

Usage

perform_ammi_single_trait(data, env_col, gen_col, rep_col, trait_col)

Arguments

data

A data frame containing the dataset with required columns.

env_col

Character. Name of the environment column.

gen_col

Character. Name of the genotype column.

rep_col

Character. Name of the replication column.

trait_col

Character. Name of the trait column to be analyzed.

Value

A list containing:

  • 'analysis': The AMMI analysis results.

  • 'biplot': The biplot (PC1 vs PC2).

  • 'pc1_plot': The PC1 vs Trait plot.

Examples


set.seed(123)
data <- data.frame(
  GEN = rep(c("G1", "G2", "G3", "G4"), each = 12),
  ENV = rep(c("E1", "E2", "E3"), each = 4, times = 4),
  REP = rep(1:3, times = 16),
  Y = c(rnorm(12, 50, 5), rnorm(12, 55, 5), rnorm(12, 60, 5), rnorm(12, 65, 5))
)
results <- perform_ammi_single_trait(data, "ENV", "GEN", "REP", "Y")


CropBreeding documentation built on April 4, 2025, 4:43 a.m.