# \donttest{
if (!requireNamespace("metan", quietly = TRUE)) {
install.packages("metan")
}
library(metan)
# Simulated dataset
set.seed(123)
data <- data.frame(
Genotype = rep(c("G1", "G2", "G3"), each = 12),
Environment = rep(c("E1", "E2", "E3", "E4"), times = 9),
Replication = rep(1:3, times = 12),
Trait1 = c(rnorm(36, 50, 5)),
Trait2 = c(rnorm(36, 150, 10)),
Trait3 = c(rnorm(36, 250, 15))
)
results <- stability_analysis(
data = data,
genotype_col = "Genotype",
environment_col = "Environment",
replication_col = "Replication",
trait_cols = c("Trait1", "Trait2", "Trait3")
)
print(results$Trait1$anova)
print(results$Trait1$regression)
# }
Run the code above in your browser using DataLab