Learn R Programming

CropBreeding (version 0.1.0)

perform_ammi_single_trait: 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)

Value

A list containing:

  • `analysis`: The AMMI analysis results.

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

  • `pc1_plot`: The PC1 vs Trait plot.

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.

Examples

Run this code
# \donttest{
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")
# }

Run the code above in your browser using DataLab