# NOT RUN {
library(metan)
desc_stat(data_ge2, TKW)
# Compute the main statistics
# Use a numeric vector as input data
vect <- data_ge2$TKW
desc_stat(values = vect)
# Select specific statistics
desc_stat(values = c(12, 13, 19, 21, 8, NA, 23, NA),
na.rm = TRUE,
stats = c('mean, se.mean, cv, n, valid.n'))
# Compute the main statistics for each level of "ENV"
stats <-
desc_stat(data_ge2,
EP, EL, EH, ED, PH, CD,
by = ENV,
verbose = FALSE)
# To get a 'wide' format with the statistics of the variable EP above.
desc_wider(stats, PH)
# Compute all the statistics for each combination of "ENV" and "GEN"
# All the numeric variables in .data
stats_all <-
data_ge2 %>%
split_factors(ENV, GEN) %>%
desc_stat(stats = "all", verbose = FALSE)
desc_wider(stats_all, PH)
# }
Run the code above in your browser using DataCamp Workspace