Descriptive statistics consist on presenting the distribution of series for a sample in tables (frequency table for one series, contingency tables for two series), ploting this distribution and computing some statistics that summarise it. descstat provides a complete toolbox to perform this tasks. It has been writen using some packages of the tidyverse (especially dplyr, tidyr and purrr) and its usage follow the tidyverse conventions, especially the selection of series using their unquoted names and the use of the pipe operator and of tibbles.
In a frequency (or contingency table), continuous numerical series are presented as bins. Moreover, for some surveys, the individual values are not known, but only the fact that these values belongs to a bin. Therefore, it is crucial to be able to work easily with bins, ie:
creating bins from numerical values, which is performed by the
base::cut function which turns a numerical series to a bin,
coercing bins to numerical values, eg getting from the
bin the lower bound (10), the upper bound (20), the center (15) or
whatever other value of the bin,
reducing the number of bins by merging some of them (for example
these latter two tasks are performed using the new
provided by this package and the accompanying
for the coercion to numeric and the
cut method for bins
merging. Especially, coercing bins to their center values is the
basis of the computation of descripting statistics for bins.
cont_table are based on the
function but offer a much richer interface and performs easily
usual operations which are tedious to obtain with
base::table functions. This includes:
adding a total,
for frequency tables, computing other kind of frequencies than the counts, for example relative frequencies, percentage, cummulative frequencies, etc.,
for contingency tables, computing easily the joint, marginal and conditional distributions,
printing easily the contingency table as a double entry table.
pre_plot function is provided to put the tibble in form in
order to use classic plots for univariate or bivariate
distributions. This includes histogram, frequency plot, pie chart,
cummulative plot and Lorenz curve. The final plot can then be
obtained using some geoms of ggplot2.
A full set of statistical functions (of central tendency,
dispersion, shape, concentration and covariation) are provided and
can be applied directly on objects of class
cont_table. Some of them are methods of generics defined by the
stats package, some other are defined as methods for
generics function provided by the descstat function when the
corresponding R function is not generic. For example,
mean is generic, so that we wrote a
mean.freq_table method to compute directly the mean of a series
from a frequency table.
var is not generic, so that we provide the
and a method for
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.