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 in a single procedure a vector of variables may be used. For example
resp = c(var1, var2, var3)
. Select helpers are also allowed.- type
The type of results. Defaults to
"winners"
(default), i.e., a two-way table with the winner genotype in each environment. Iftype = "ranks"
return the genotype ranking within each environment.- better
A vector of the same length of the number of variables to rank the genotypes according to the response variable. Each element of the vector must be one of the
'h'
or'l'
. If'h'
is used (default), the genotypes are ranked from maximum to minimum. If'l'
is used then the are ranked from minimum to maximum. Use a comma-separated vector of names. For example,better = c("h, h, h, h, l")
, for ranking the fifth variable from minimum to maximum.
Value
A tibble with two-way table with the winner genotype in each
environment (default) or the genotype ranking for each environment (if
type = "ranks"
).
Author
Tiago Olivoto tiagoolivoto@gmail.com
Examples
# \donttest{
library(metan)
ge_winners(data_ge, ENV, GEN, resp = everything())
#> # A tibble: 14 × 3
#> ENV GY HM
#> <fct> <chr> <chr>
#> 1 E1 G2 G5
#> 2 E10 G8 G5
#> 3 E11 G8 G6
#> 4 E12 G8 G6
#> 5 E13 G8 G8
#> 6 E14 G3 G7
#> 7 E2 G3 G5
#> 8 E3 G2 G10
#> 9 E4 G10 G10
#> 10 E5 G8 G10
#> 11 E6 G3 G4
#> 12 E7 G7 G8
#> 13 E8 G8 G8
#> 14 E9 G4 G10
# Assuming that for 'GY' lower values are better.
ge_winners(data_ge, ENV, GEN,
resp = everything(),
better = c("l, h"))
#> # A tibble: 14 × 3
#> ENV GY HM
#> <fct> <chr> <chr>
#> 1 E1 G10 G5
#> 2 E10 G10 G5
#> 3 E11 G10 G6
#> 4 E12 G10 G6
#> 5 E13 G10 G8
#> 6 E14 G2 G7
#> 7 E2 G7 G5
#> 8 E3 G6 G10
#> 9 E4 G7 G10
#> 10 E5 G10 G10
#> 11 E6 G6 G4
#> 12 E7 G9 G8
#> 13 E8 G2 G8
#> 14 E9 G9 G10
# Show the genotype ranking for each environment
ge_winners(data_ge, ENV, GEN,
resp = everything(),
type = "ranks")
#> # A tibble: 140 × 3
#> ENV GY HM
#> <fct> <chr> <chr>
#> 1 E1 G2 G5
#> 2 E1 G8 G4
#> 3 E1 G3 G6
#> 4 E1 G7 G8
#> 5 E1 G4 G9
#> 6 E1 G1 G7
#> 7 E1 G9 G10
#> 8 E1 G6 G1
#> 9 E1 G5 G3
#> 10 E1 G10 G2
#> # ℹ 130 more rows
# }