knitr::opts_chunk$set(
  warning = FALSE,
  message = FALSE,
  collapse = TRUE,
  comment = "",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

agriutilities

CRAN status Lifecycle: stable CRAN RStudio mirror downloads CRAN RStudio mirror downloads

agriutilities is an R package designed to make the analysis of field trials easier and more accessible for everyone working in plant breeding. It provides a simple and intuitive interface for conducting single and multi-environmental trial analysis, with minimal coding required. Whether you're a beginner or an experienced user, agriutilities will help you quickly and easily carry out complex analyses with confidence. With built-in functions for fitting Linear Mixed Models (LMM), agriutilities is the ideal choice for anyone who wants to save time and focus on interpreting their results.

Installation

From CRAN

install.packages("agriutilities")

From GitHub

You can install the development version of agriutilities from GitHub with:

remotes::install_github("AparicioJohan/agriutilities")

Automatic Data Analysis Pipeline

This is a basic example which shows you how to use some of the functions of the package.

Identify the Experimental Design

The function check_design_met helps us to check the quality of the data and also to identify the experimental design of the trials. This works as a quality check or quality control before we fit any model.

library(agriutilities)
library(agridat)
data(besag.met)
dat <- besag.met
results <- check_design_met(
  data = dat,
  genotype = "gen",
  trial = "county",
  traits = "yield",
  rep = "rep",
  block = "block",
  col = "col",
  row = "row"
)
plot(results, type = "connectivity")
plot(results, type = "missing")

Inspecting the output.

print(results)

Single Trial Analysis (STA)

The results of the previous function are used in single_trial_analysis() to fit single trial models. This function can fit, Completely Randomized Designs (CRD), Randomized Complete Block Designs (RCBD), Resolvable Incomplete Block Designs (res-IBD), Non-Resolvable Row-Column Designs (Row-Col) and Resolvable Row-Column Designs (res-Row-Col).

NOTE: It fits models based on the randomization detected.

obj <- single_trial_analysis(results, progress = FALSE)

Inspecting the output.

print(obj)
plot(obj, horizontal = TRUE, nudge_y_h2 = 0.12)
plot(obj, type = "correlation")

The returning object is a set of lists with trial summary, BLUEs, BLUPs, heritability, variance components, potential extreme observations, residuals, the models fitted and the data used.

Two-Stage Analysis (MET)

The results of the previous function are used in met_analysis() to fit multi-environmental trial models.

met_results <- met_analysis(obj, vcov = "fa2", progress = FALSE)

Inspecting the output.

print(met_results)

Exploring Factor Analytic in MET analysis.

pvals <- met_results$trial_effects
model <- met_results$met_models$yield
fa_objt <- fa_summary(
  model = model,
  trial = "trial",
  genotype = "genotype",
  BLUEs_trial = pvals,
  k_biplot = 8,
  size_label_var = 4,
  filter_score = 1
)
fa_objt$plots$loadings_c
fa_objt$plots$biplot

For more information and to learn more about what is described here you may find useful the following sources: @isik2017genetic; @rodriguez2018correcting.

Code of Conduct

Please note that the agriutilities project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

References



AparicioJohan/agriutilities documentation built on Jan. 20, 2025, 7:53 a.m.