desc_wider 'widens' an object of class desc_stat increasing the number of columns and decreasing the number of rows. This is speccialy useful when the descriptive statistics were computed for each level of a factor using the function split_factors to pass subsetted data.to pass subsetted data to code.data.to pass subsetted data to code.data.

desc_wider(.data, var)

Arguments

.data

An output of the function desc_stat.

var

The variable in .data to show the results.

Value

A tibble with the statistics in the columns and levels of the factor(s) in the rows.

Examples

# \donttest{ library(metan) df <- data_ge2 %>% split_factors(GEN) %>% desc_stat(EP, EL, PH, CL, stats = c('mean, CI.mean, SE.mean, var.amo, CV'), verbose = FALSE)
#> Warning: Use 'keep_factors = TRUE' to keep the columns ENV GEN REP in the grouped data.
print(df, n = 15)
#> # A tibble: 65 x 6 #> GEN Statistic CL EL EP PH #> <chr> <chr> <dbl> <dbl> <dbl> <dbl> #> 1 H1 ci.mean 1.02 0.602 0.0359 0.195 #> 2 H1 cv 5.33 6.27 9.91 11.7 #> 3 H1 mean 30.1 15.1 0.570 2.62 #> 4 H1 se.mean 0.462 0.273 0.0163 0.0885 #> 5 H1 var.amo 2.56 0.897 0.00320 0.0940 #> 6 H10 ci.mean 1.89 0.656 0.0395 0.217 #> 7 H10 cv 10.5 6.83 11.4 14.8 #> 8 H10 mean 28.4 15.1 0.545 2.31 #> 9 H10 se.mean 0.860 0.298 0.0180 0.0987 #> 10 H10 var.amo 8.88 1.07 0.00387 0.117 #> 11 H11 ci.mean 1.27 0.818 0.0307 0.218 #> 12 H11 cv 7.08 8.46 9.18 14.4 #> 13 H11 mean 28.3 15.2 0.527 2.39 #> 14 H11 se.mean 0.577 0.372 0.0140 0.0991 #> 15 H11 var.amo 4.00 1.66 0.00234 0.118 #> # ... with 50 more rows
desc_wider(df, PH)
#> # A tibble: 13 x 6 #> GEN ci.mean cv mean se.mean var.amo #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 H1 0.195 11.7 2.62 0.0885 0.0940 #> 2 H10 0.217 14.8 2.31 0.0987 0.117 #> 3 H11 0.218 14.4 2.39 0.0991 0.118 #> 4 H12 0.191 12.4 2.44 0.0870 0.0908 #> 5 H13 0.151 9.39 2.54 0.0688 0.0568 #> 6 H2 0.217 13.1 2.60 0.0988 0.117 #> 7 H3 0.254 15.4 2.59 0.115 0.160 #> 8 H4 0.226 13.8 2.58 0.103 0.127 #> 9 H5 0.200 12.3 2.57 0.0910 0.0993 #> 10 H6 0.190 11.7 2.56 0.0863 0.0894 #> 11 H7 0.191 12.5 2.40 0.0868 0.0905 #> 12 H8 0.210 14.2 2.33 0.0953 0.109 #> 13 H9 0.233 15.5 2.36 0.106 0.135
# }