Arguments
- .data
- The dataset containing the columns related to Environments, Genotypes, and the response variable(s). 
- env
- The name of the column that contains the levels of the environments. 
- gen
- The name of the column that contains the levels of the genotypes. 
- resp
- The response variable(s). To analyze multiple variables at once, a vector of variables may be used. For example - resp = c(var1, var2, var3). Select helpers are also allowed.
Value
A list where each element is the result for one variable containing:
- ge_means: A two-way table with the means for genotypes (rows) and environments (columns). 
- gen_means: A tibble with the means for genotypes. 
- env_means: A tibble with the means for environments. 
Author
Tiago Olivoto tiagoolivoto@gmail.com
Examples
# \donttest{
library(metan)
means_ge <- ge_means(data_ge, ENV, GEN, resp = everything())
# Genotype-environment interaction means
get_model_data(means_ge)
#> Class of the model: ge_means
#> Variable extracted: ge_means
#> # A tibble: 140 × 4
#>    ENV   GEN      GY    HM
#>    <fct> <fct> <dbl> <dbl>
#>  1 E1    G1     2.37  46.5
#>  2 E1    G10    1.97  46.9
#>  3 E1    G2     2.90  45.3
#>  4 E1    G3     2.89  45.9
#>  5 E1    G4     2.59  48.3
#>  6 E1    G5     2.19  49.9
#>  7 E1    G6     2.30  48.2
#>  8 E1    G7     2.77  47.4
#>  9 E1    G8     2.90  48.0
#> 10 E1    G9     2.33  47.7
#> # … with 130 more rows
# Environment means
get_model_data(means_ge, what = "env_means")
#> Class of the model: ge_means
#> Variable extracted: env_means
#> # A tibble: 14 × 3
#>    ENV      GY    HM
#>    <fct> <dbl> <dbl>
#>  1 E1     2.52  47.4
#>  2 E10    2.18  44.3
#>  3 E11    1.37  54.2
#>  4 E12    1.61  49.6
#>  5 E13    2.91  46.6
#>  6 E14    1.78  41.0
#>  7 E2     3.18  44.1
#>  8 E3     4.06  52.9
#>  9 E4     3.68  50  
#> 10 E5     3.91  52.2
#> 11 E6     2.66  45.9
#> 12 E7     1.99  48.5
#> 13 E8     2.54  45.2
#> 14 E9     3.06  51.3
# Genotype means
get_model_data(means_ge, what = "gen_means")
#> Class of the model: ge_means
#> Variable extracted: gen_means
#> # A tibble: 10 × 3
#>    GEN      GY    HM
#>    <fct> <dbl> <dbl>
#>  1 G1     2.60  47.1
#>  2 G10    2.47  48.5
#>  3 G2     2.74  46.7
#>  4 G3     2.96  47.6
#>  5 G4     2.64  48.0
#>  6 G5     2.54  49.3
#>  7 G6     2.53  48.7
#>  8 G7     2.74  48.0
#>  9 G8     3.00  49.1
#> 10 G9     2.51  47.9
# }
