Runs the analysis of variance for several traits at once and assembles the table that agronomy journals and theses expect: treatment means followed by letters, then SEm, CD and CV for each trait (with "NS" when the F-test is not significant). Works for completely randomized, randomized block, two-factor factorial and split-plot designs.
Usage
anova_traits(
data,
traits,
design = c("rbd", "crd", "factorial", "spd"),
treatment = NULL,
block = NULL,
factor1 = NULL,
factor2 = NULL,
main_plot = NULL,
sub_plot = NULL,
posthoc = "lsd",
alpha = 0.05,
digits = 2,
letters_if_ns = FALSE,
verbose = TRUE
)Arguments
- data
Data frame with one row per plot.
- traits
Character vector of response columns.
- design
One of
"rbd"(default),"crd","factorial"or"spd".- treatment
Treatment column (CRD and RBD).
- block
Block (replication) column (RBD, factorial in blocks and split-plot).
- factor1, factor2
The two factors of a factorial design.
- main_plot, sub_plot
Main-plot and sub-plot factors of a split-plot design.
- posthoc
Method for the letters:
"lsd"(default),"duncan","tukey","snk","scheffe"or"bonferroni".- alpha
Significance level. Default 0.05.
- digits
Decimal places for means, SEm and CD. A single number, or one per trait. Default 2.
- letters_if_ns
Logical. If FALSE (default), letters are omitted when the F-test of that factor is not significant.
- verbose
Logical. If TRUE (default), prints the table.
Value
An object of class aridagri_traits with table
(character data frame ready to export), stats (F, p, SEm, SEd,
CD and CV for each trait and factor) and results (the full
analysis for each trait). Export with export_results.
Examples
data(mothbean_rbd)
tab <- anova_traits(mothbean_rbd,
traits = c("plant_height", "pods_per_plant",
"seed_yield", "harvest_index"),
design = "rbd", treatment = "treatment",
block = "block", posthoc = "duncan")
#>
#> ======================================================================
#> TREATMENT MEANS FOR 4 TRAIT(S) (RBD)
#> ======================================================================
#> treatment plant_height pods_per_plant seed_yield harvest_index
#> T1 Control 30.25 c 19.05 e 516.25 d 29.77
#> T2 RDF 33.33 ab 24.70 cd 604.75 c 30.30
#> T3 RDF+Rhizobium 33.28 ab 25.10 cd 650.75 bc 32.00
#> T4 RDF+PSB 33.93 ab 26.42 bc 632.25 bc 30.77
#> T5 RDF+Rhizobium+PSB 35.00 a 29.10 a 705.00 a 32.33
#> T6 75% RDF+FYM 35.17 a 27.80 ab 662.75 ab 32.28
#> T7 RDF+S20 34.48 ab 26.75 bc 610.75 c 30.83
#> T8 RDF+Zn5 32.90 b 23.75 d 639.75 bc 32.07
#> SEm ± 0.63 0.75 15.60 0.77
#> CD (p = 0.05) 1.86 2.21 45.88 NS
#> CV (%) 3.77 5.93 4.97 4.91
#>
#> Means followed by the same letter do not differ significantly (Duncan's MRT, p = 0.05).
#> NS: not significant. Full results for each trait are in $results.
tab$table
#> treatment plant_height pods_per_plant seed_yield harvest_index
#> 1 T1 Control 30.25 c 19.05 e 516.25 d 29.77
#> 2 T2 RDF 33.33 ab 24.70 cd 604.75 c 30.30
#> 3 T3 RDF+Rhizobium 33.28 ab 25.10 cd 650.75 bc 32.00
#> 4 T4 RDF+PSB 33.93 ab 26.42 bc 632.25 bc 30.77
#> 5 T5 RDF+Rhizobium+PSB 35.00 a 29.10 a 705.00 a 32.33
#> 6 T6 75% RDF+FYM 35.17 a 27.80 ab 662.75 ab 32.28
#> 7 T7 RDF+S20 34.48 ab 26.75 bc 610.75 c 30.83
#> 8 T8 RDF+Zn5 32.90 b 23.75 d 639.75 bc 32.07
#> 9 SEm ± 0.63 0.75 15.60 0.77
#> 10 CD (p = 0.05) 1.86 2.21 45.88 NS
#> 11 CV (%) 3.77 5.93 4.97 4.91
data(clusterbean_spd)
anova_traits(clusterbean_spd, traits = c("seed_yield", "wue"),
design = "spd", main_plot = "irrigation",
sub_plot = "nitrogen", block = "rep")
#>
#> ======================================================================
#> TREATMENT MEANS FOR 2 TRAIT(S) (SPD)
#> ======================================================================
#> Treatment seed_yield wue
#> Main plot: irrigation
#> I1 Rainfed 891.50 c 4.20 a
#> I2 One irrigation 1179.83 b 4.33 a
#> I3 Two irrigations 1300.00 a 3.92 b
#> SEm ± 16.33 0.04
#> CD (p = 0.05) 64.13 0.16
#> Sub-plot: nitrogen
#> N0 1011.11 d 3.74 d
#> N10 1102.22 c 4.08 c
#> N20 1167.33 b 4.31 b
#> N20+Foliar 1214.44 a 4.47 a
#> SEm ± 9.32 0.04
#> CD (p = 0.05) 27.68 0.13
#> irrigation x nitrogen
#> CD (p = 0.05): nitrogen at same irrigation 47.94 NS
#> CD (p = 0.05): irrigation at same nitrogen 75.72 NS
#> CV(a) (%) 5.03 3.42
#> CV(b) (%) 2.49 3.09
#>
#> Means followed by the same letter do not differ significantly (Fisher's LSD, p = 0.05).
#> NS: not significant. Full results for each trait are in $results.
