-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathREADME.Rmd
173 lines (128 loc) · 4.54 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
---
output: github_document
bibliography: ./vignettes/bibliography.bib
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
warning = FALSE,
message = FALSE,
collapse = TRUE,
comment = "",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# agriutilities <img src="man/figures/logo.png" align="right" width="160px"/></a>
<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/agriutilities)](https://CRAN.R-project.org/package=agriutilities)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/last-month/agriutilities?color=blue)](https://r-pkg.org/pkg/agriutilities)
[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/grand-total/agriutilities?color=blue)](https://r-pkg.org/pkg/agriutilities)
<!-- badges: end -->
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
``` r
install.packages("agriutilities")
```
### From GitHub
You can install the development version of agriutilities from
[GitHub](https://github.com/AparicioJohan/agriutilities) with:
``` r
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.
```{r}
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"
)
```
```{r, fig.dpi=600}
plot(results, type = "connectivity")
plot(results, type = "missing")
```
Inspecting the output.
```{r}
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.
```{r}
obj <- single_trial_analysis(results, progress = FALSE)
```
Inspecting the output.
```{r}
print(obj)
```
```{r, fig.dpi=600}
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.
```{r, message=FALSE, warning=FALSE}
met_results <- met_analysis(obj, vcov = "fa2", progress = FALSE)
```
Inspecting the output.
```{r}
print(met_results)
```
### Exploring Factor Analytic in MET analysis.
```{r}
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
)
```
```{r, fig.dpi=600}
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](https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html).
By contributing to this project, you agree to abide by its terms.
# References