desc_stat  R Documentation 
desc_stat()
Computes the most used measures of central tendency,
position, and dispersion.
desc_wider()
is useful to put the variables in columns and grouping
variables in rows. The table is filled with a statistic chosen with the
argument stat
.
desc_stat( .data = NULL, ..., by = NULL, stats = "main", hist = FALSE, level = 0.95, digits = 4, na.rm = FALSE, verbose = TRUE, plot_theme = theme_metan() ) desc_wider(.data, which)
.data 
The data to be analyzed. It can be a data frame (possible with
grouped data passed from 
... 
A single variable name or a commaseparated list of unquoted
variables names. If no variable is informed, all the numeric variables from

by 
One variable (factor) to compute the function by. It is a shortcut
to 
stats 
The descriptive statistics to show. This is used to filter the
output after computation. Defaults to
Use a names to select the statistics. For example, 
hist 
Logical argument defaults to 
level 
The confidence level to compute the confidence interval of mean. Defaults to 0.95. 
digits 
The number of significant digits. 
na.rm 
Logical. Should missing values be removed? Defaults to 
verbose 
Logical argument. If 
plot_theme 
The graphical theme of the plot. Default is

which 
A statistic to fill the table. 
desc_stats()
returns a tibble with the statistics in the columns and
variables (with possible grouping factors) in rows.
desc_wider()
returns a tibble with variables in columns and grouping
factors in rows.
Tiago Olivoto tiagoolivoto@gmail.com
library(metan) #===============================================================# # Example 1: main statistics (coefficient of variation, maximum,# # mean, median, minimum, sample standard deviation, standard # # error and confidence interval of the mean) for all numeric # # variables in data # #===============================================================# desc_stat(data_ge2) #===============================================================# #Example 2: robust statistics using a numeric vector as input # # data #===============================================================# vect < data_ge2$TKW desc_stat(vect, stats = "robust") #===============================================================# # Example 3: Select specific statistics. In this example, NAs # # are removed before analysis with a warning message # #===============================================================# desc_stat(c(12, 13, 19, 21, 8, NA, 23, NA), stats = c('mean, se, cv, n, n.valid'), na.rm = TRUE) #===============================================================# # Example 4: Select specific variables and compute statistics by# # levels of a factor variable (GEN) # #===============================================================# stats < desc_stat(data_ge2, EP, EL, EH, ED, PH, CD, by = GEN) stats # To get a 'wide' format with the maximum values for all variables desc_wider(stats, max) #===============================================================# # Example 5: Compute all statistics for all numeric variables # # by two or more factors. Note that group_by() was used to pass # # grouped data to the function desc_stat() # #===============================================================# data_ge2 %>% group_by(ENV, GEN) %>% desc_stat()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.