| Title: | Generate Descriptive Statistics |
|---|---|
| Description: | Generate descriptive statistics such as measures of location, dispersion, frequency tables, cross tables, group summaries and multiple one/two way tables. |
| Authors: | Aravind Hebbali [aut, cre] (ORCID: <https://orcid.org/0000-0001-9220-9669>) |
| Maintainer: | Aravind Hebbali <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.6.1 |
| Built: | 2026-11-13 18:40:32 UTC |
| Source: | https://github.com/rsquaredacademy/descriptr |
ds_auto_freq_table creates multiple one way tables by creating
a frequency table for each categorical variable in a data frame.
ds_auto_cross_table creates multiple two way tables by creating a cross
table for each unique pair of categorical variables in a data frame.
ds_auto_freq_table(data, ...) ds_auto_cross_table(data, ...)ds_auto_freq_table(data, ...) ds_auto_cross_table(data, ...)
data |
A |
... |
Column(s) in |
ds_auto_freq_table is a extension of the ds_freq_table
function. It creates a frequency table for each categorical variable in the
dataframe. ds_auto_cross_table is a extension of the ds_cross_table
function. It creates a two way table for each unique pair of categorical
variables in the dataframe.
ds_oway_tables() and ds_tway_tables() have been deprecated.
Instead use ds_auto_freq_table() and ds_auto_cross_table().
# frequency table for all columns ds_auto_freq_table(mtcarz) # frequency table for multiple columns ds_auto_freq_table(mtcarz, cyl, gear) # cross table for all columns ds_auto_cross_table(mtcarz) # cross table for multiple columns ds_auto_cross_table(mtcarz, cyl, gear, am)# frequency table for all columns ds_auto_freq_table(mtcarz) # frequency table for multiple columns ds_auto_freq_table(mtcarz, cyl, gear) # cross table for all columns ds_auto_cross_table(mtcarz) # cross table for multiple columns ds_auto_cross_table(mtcarz, cyl, gear, am)
Generate summary statistics for all continuous variables in data.
ds_auto_group_summary(data, ...)ds_auto_group_summary(data, ...)
data |
A |
... |
Column(s) in |
# summary statistics of mpg & disp for each level of cyl & gear ds_auto_group_summary(mtcarz, cyl, gear, mpg, disp)# summary statistics of mpg & disp for each level of cyl & gear ds_auto_group_summary(mtcarz, cyl, gear, mpg, disp)
Generate summary statistics & frequency table for all continuous variables in data.
ds_auto_summary_stats(data, ...)ds_auto_summary_stats(data, ...)
data |
A |
... |
Column(s) in |
# all columns ds_auto_summary_stats(mtcarz) # multiple columns ds_auto_summary_stats(mtcarz, disp, hp)# all columns ds_auto_summary_stats(mtcarz) # multiple columns ds_auto_summary_stats(mtcarz, disp, hp)
Creates two way tables of categorical variables. The tables created can be visualized as bar plots and mosaic plots.
ds_cross_table(data, var_1, var_2) ## S3 method for class 'ds_cross_table' plot(x, stacked = FALSE, proportional = FALSE, print_plot = TRUE, ...) ds_twoway_table(data, var_1, var_2)ds_cross_table(data, var_1, var_2) ## S3 method for class 'ds_cross_table' plot(x, stacked = FALSE, proportional = FALSE, print_plot = TRUE, ...) ds_twoway_table(data, var_1, var_2)
data |
A |
var_1 |
First categorical variable. |
var_2 |
Second categorical variable. |
x |
An object of class |
stacked |
If |
proportional |
If |
print_plot |
logical; if |
... |
Further arguments to be passed to or from methods. |
ds_cross_table() returns an object of class
"ds_cross_table" containing the contingency table and the utility
information used to print it. The cell percentages are stored as
proportions (values between 0 and 1) in percent_table,
row_percent, column_percent and percent_column. The
printed cells show percentages computed from the counts and can differ from
the rounded proportions stored in the object in the last decimal place. The
number of rows dropped because either variable is
missing is stored in utility$missing. ds_twoway_table()
returns a tibble whose percent, row_percent and
col_percent columns are also proportions.
# cross table k <- ds_cross_table(mtcarz, cyl, gear) k # bar plot plot(k) # stacked bar plot plot(k, stacked = TRUE) # proportional bar plot plot(k, proportional = TRUE) # returns tibble ds_twoway_table(mtcarz, cyl, gear)# cross table k <- ds_cross_table(mtcarz, cyl, gear) k # bar plot plot(k) # stacked bar plot plot(k, stacked = TRUE) # proportional bar plot plot(k, proportional = TRUE) # returns tibble ds_twoway_table(mtcarz, cyl, gear)
Compute the corrected sum of squares
ds_css(data, x = NULL)ds_css(data, x = NULL)
data |
A numeric vector or |
x |
Column in |
# vector ds_css(mtcars$mpg) # data.frame ds_css(mtcars, mpg)# vector ds_css(mtcars$mpg) # data.frame ds_css(mtcars, mpg)
Compute the coefficient of variation
ds_cvar(data, x = NULL)ds_cvar(data, x = NULL)
data |
A numeric vector or |
x |
Column in |
# vector ds_cvar(mtcars$mpg) # data.frame ds_cvar(mtcars, mpg)# vector ds_cvar(mtcars$mpg) # data.frame ds_cvar(mtcars, mpg)
Returns the most extreme observations and their original row indices.
ds_extreme_obs(data, col, decimals = 2)ds_extreme_obs(data, col, decimals = 2)
data |
A numeric vector or |
col |
Column in |
decimals |
An option to specify the exact number of decimal places to use. The default number of decimal places is 2. |
Missing values are removed before the k = min(5, n) lowest and
highest observations are selected. The row indices refer to the data passed
in, and ties are reported on distinct rows. decimals applies to both
vector and data.frame input.
# data.frame ds_extreme_obs(mtcarz, mpg) # vector ds_extreme_obs(mtcarz$mpg) # decimal places ds_extreme_obs(mtcarz$mpg, decimals = 3)# data.frame ds_extreme_obs(mtcarz, mpg) # vector ds_extreme_obs(mtcarz$mpg) # decimal places ds_extreme_obs(mtcarz$mpg, decimals = 3)
Frequency table for categorical and continuous data and returns the
frequency, cumulative frequency, frequency percent and cumulative frequency
percent. plot.ds_freq_table() creates bar plot for the categorical
data and histogram for continuous data.
ds_freq_table(data, col, bins = 5, closed = c("left", "right", "both")) ## S3 method for class 'ds_freq_table' plot(x, print_plot = TRUE, ...)ds_freq_table(data, col, bins = 5, closed = c("left", "right", "both")) ## S3 method for class 'ds_freq_table' plot(x, print_plot = TRUE, ...)
data |
A |
col |
Column in |
bins |
Number of intervals into which the data must be split; a positive whole number. |
closed |
Interval closure for continuous data. |
x |
An object of class |
print_plot |
logical; if |
... |
Further arguments to be passed to or from methods. |
Percentages are computed over all observations, including missing
values, so the Percent column and the Missing row share the
same denominator and add up to 100. Continuous data with no non-missing
observations, or with no variation, cannot be binned and raise an error.
# categorical data ds_freq_table(mtcarz, cyl) # barplot k <- ds_freq_table(mtcarz, cyl) plot(k) # continuous data ds_freq_table(mtcarz, mpg) # barplot k <- ds_freq_table(mtcarz, mpg) plot(k)# categorical data ds_freq_table(mtcarz, cyl) # barplot k <- ds_freq_table(mtcarz, cyl) plot(k) # continuous data ds_freq_table(mtcarz, mpg) # barplot k <- ds_freq_table(mtcarz, mpg) plot(k)
Computes the geometric mean
ds_gmean(data, x = NULL)ds_gmean(data, x = NULL)
data |
A numeric vector or |
x |
Column in |
Any NA values are stripped before computation. The mean is
computed on the log scale, so large values or long vectors do not overflow.
If any value is less than or equal to zero, a warning is issued and
NA is returned.
# vector ds_gmean(mtcars$mpg) # data.frame ds_gmean(mtcars, mpg)# vector ds_gmean(mtcars$mpg) # data.frame ds_gmean(mtcars, mpg)
Descriptive statistics of a continuous variable for the different levels of
a categorical variable. plot.ds_group_summary() creates boxplots of
the continuous variable for the different levels of the categorical variable.
ds_group_summary(data, group_by, cols) ## S3 method for class 'ds_group_summary' plot(x, print_plot = TRUE, ...)ds_group_summary(data, group_by, cols) ## S3 method for class 'ds_group_summary' plot(x, print_plot = TRUE, ...)
data |
A |
group_by |
Column in |
cols |
Column in |
x |
An object of the class |
print_plot |
logical; if |
... |
Further arguments to be passed to or from methods. |
Groups with missing values in the continuous variable are summarised
using the non-missing observations (na.rm = TRUE), and the number of
missing observations is reported in the Missing row of stats.
Observations with a missing grouping label are excluded from the summary and
from the boxplot. Unused levels of the grouping factor are dropped.
The grouping key in tidy_stats keeps the class of the grouping
variable (including ordered factors) and the order of the observed levels.
If the grouping column is named like one of the statistic columns, such as
length, its column in tidy_stats is suffixed with
_group so that every column name is unique.
ds_group_summary() returns an object of class "ds_group_summary".
An object of class "ds_group_summary" is a list containing the
following components:
stats |
A data frame containing descriptive statistics for the different levels of the factor variable. |
tidy_stats |
A tibble containing descriptive statistics for the different levels of the factor variable. |
plotdata |
Data for boxplot method. |
# ds_group summary ds_group_summary(mtcarz, cyl, mpg) # boxplot k <- ds_group_summary(mtcarz, cyl, mpg) plot(k) # tibble k$tidy_stats# ds_group summary ds_group_summary(mtcarz, cyl, mpg) # boxplot k <- ds_group_summary(mtcarz, cyl, mpg) plot(k) # tibble k$tidy_stats
Descriptive statistics of a continuous variable for the combination of levels of two or more categorical variables.
ds_group_summary_interact(data, col, ...)ds_group_summary_interact(data, col, ...)
data |
A |
col |
Column in |
... |
Columns in |
Character grouping columns are accepted and treated as factors.
Factor levels may contain any character, including . and \r.
Groups are formed from the values of the grouping columns themselves, so
distinct combinations that would serialize to the same character string are
never merged. Rows with a missing value in any of the selected columns are
excluded.
The grouping columns keep their names in the returned tibble. If a grouping
column is named like one of the statistic columns, such as mean, its
column is suffixed with _group so that every column name is unique
and the statistic keeps its documented name.
ds_group_summary_interact(mtcarz, mpg, cyl, gear)ds_group_summary_interact(mtcarz, mpg, cyl, gear)
Computes the harmonic mean
ds_hmean(data, x = NULL)ds_hmean(data, x = NULL)
data |
A numeric vector or |
x |
Column in |
Any NA values are stripped before computation. If any value
is less than or equal to zero, a warning is issued and NA is
returned.
# vector ds_hmean(mtcars$mpg) # data.frame ds_hmean(mtcars, mpg)# vector ds_hmean(mtcars$mpg) # data.frame ds_hmean(mtcars, mpg)
Compute the kurtosis of a probability distribution.
ds_kurtosis(data, x = NULL)ds_kurtosis(data, x = NULL)
data |
A numeric vector or |
x |
Column in |
Any NA values are stripped from x before computation
takes place. With non-missing observations, sample standard
deviation , and
this is the excess kurtosis. It matches
e1071::kurtosis(x, type = 2) and the SAS/SPSS definition.
Sheskin, D.J. (2000) Handbook of Parametric and Nonparametric Statistical Procedures, Second Edition. Boca Raton, Florida: Chapman & Hall/CRC.
ds_skewness
# vector ds_kurtosis(mtcars$mpg) # data.frame ds_kurtosis(mtcars, mpg)# vector ds_kurtosis(mtcars$mpg) # data.frame ds_kurtosis(mtcars, mpg)
Launches shiny app
ds_launch_shiny_app()ds_launch_shiny_app()
launch_descriptr() has been deprecated. Instead
use ds_launch_shiny_app().
## Not run: ds_launch_shiny_app() ## End(Not run)## Not run: ds_launch_shiny_app() ## End(Not run)
Compute the mean absolute deviation about the mean
ds_mdev(data, x = NULL)ds_mdev(data, x = NULL)
data |
A numeric vector or |
x |
Column in |
The ds_mdev function computes the mean absolute deviation
about the mean. It is different from mad in stats package as
the statistic used to compute the deviations is not median but
mean. Any NA values are stripped from x before computation
takes place
# vector ds_mdev(mtcars$mpg) # data.frame ds_mdev(mtcars, mpg)# vector ds_mdev(mtcars$mpg) # data.frame ds_mdev(mtcars, mpg)
Returns the measures of location such as mean, median & mode.
ds_measures_location(data, ..., trim = 0.05, decimals = 2)ds_measures_location(data, ..., trim = 0.05, decimals = 2)
data |
A |
... |
Column(s) in |
trim |
The fraction of values to be trimmed before computing the mean. |
decimals |
An option to specify the exact number of decimal places to use. The default number of decimal places is 2. |
n reports the total number of observations and
missing the number of missing values; the measures themselves are
computed from the non-missing values.
# single column ds_measures_location(mtcarz, mpg) # multiple columns ds_measures_location(mtcarz, mpg, disp) # all columns ds_measures_location(mtcarz) # vector ds_measures_location(mtcarz$mpg) # vectors of different length disp <- mtcarz$disp[1:10] ds_measures_location(mtcarz$mpg, disp) # decimal places ds_measures_location(mtcarz, disp, hp, decimals = 3)# single column ds_measures_location(mtcarz, mpg) # multiple columns ds_measures_location(mtcarz, mpg, disp) # all columns ds_measures_location(mtcarz) # vector ds_measures_location(mtcarz$mpg) # vectors of different length disp <- mtcarz$disp[1:10] ds_measures_location(mtcarz$mpg, disp) # decimal places ds_measures_location(mtcarz, disp, hp, decimals = 3)
Returns the measures of symmetry such as skewness and kurtosis.
ds_measures_symmetry(data, ..., decimals = 2)ds_measures_symmetry(data, ..., decimals = 2)
data |
A |
... |
Column(s) in |
decimals |
An option to specify the exact number of decimal places to use. The default number of decimal places is 2. |
n reports the number of non-missing observations and the
measures are computed from the non-missing values, for both vector and
data-frame input. A variable with no non-missing observations returns
n = 0 and NA for every measure.
# single column ds_measures_symmetry(mtcarz, mpg) # multiple columns ds_measures_symmetry(mtcarz, mpg, disp) # all columns ds_measures_symmetry(mtcarz) # vector ds_measures_symmetry(mtcarz$mpg) # vectors of different length disp <- mtcarz$disp[1:10] ds_measures_symmetry(mtcarz$mpg, disp) # decimal places ds_measures_symmetry(mtcarz, disp, hp, decimals = 3)# single column ds_measures_symmetry(mtcarz, mpg) # multiple columns ds_measures_symmetry(mtcarz, mpg, disp) # all columns ds_measures_symmetry(mtcarz) # vector ds_measures_symmetry(mtcarz$mpg) # vectors of different length disp <- mtcarz$disp[1:10] ds_measures_symmetry(mtcarz$mpg, disp) # decimal places ds_measures_symmetry(mtcarz, disp, hp, decimals = 3)
Returns the measures of variation such as range, variance and standard deviation.
ds_measures_variation(data, ..., decimals = 2)ds_measures_variation(data, ..., decimals = 2)
data |
A |
... |
Column(s) in |
decimals |
An option to specify the exact number of decimal places to use. The default number of decimal places is 2. |
n reports the number of non-missing observations and every
measure is computed from the non-missing values, for both vector and
data-frame input. A variable with no non-missing observations returns
n = 0 and NA for every measure.
# single column ds_measures_variation(mtcarz, mpg) # multiple columns ds_measures_variation(mtcarz, mpg, disp) # all columns ds_measures_variation(mtcarz) # vector ds_measures_variation(mtcarz$mpg) # vectors of different length disp <- mtcarz$disp[1:10] ds_measures_variation(mtcarz$mpg, disp) # decimal places ds_measures_variation(mtcarz, disp, hp, decimals = 3)# single column ds_measures_variation(mtcarz, mpg) # multiple columns ds_measures_variation(mtcarz, mpg, disp) # all columns ds_measures_variation(mtcarz) # vector ds_measures_variation(mtcarz$mpg) # vectors of different length disp <- mtcarz$disp[1:10] ds_measures_variation(mtcarz$mpg, disp) # decimal places ds_measures_variation(mtcarz, disp, hp, decimals = 3)
Compute the sample mode
ds_mode(data, x = NULL)ds_mode(data, x = NULL)
data |
A numeric vector or |
x |
Column in |
Any NA values are stripped from x before computation
takes place. If several values are tied for the highest frequency, the
smallest of them is returned.
Mode of x
# vector ds_mode(mtcars$mpg) # data.frame ds_mode(mtcars, mpg)# vector ds_mode(mtcars$mpg) # data.frame ds_mode(mtcars, mpg)
Returns the percentiles
ds_percentiles(data, ..., decimals = 2)ds_percentiles(data, ..., decimals = 2)
data |
A |
... |
Column(s) in |
decimals |
An option to specify the exact number of decimal places to use. The default number of decimal places is 2. |
n reports the number of non-missing observations and the
percentiles are computed from the non-missing values, for both vector and
data-frame input. A variable with no non-missing observations returns
n = 0 and NA for every percentile.
# single column ds_percentiles(mtcarz, mpg) # multiple columns ds_percentiles(mtcarz, mpg, disp) # all columns ds_percentiles(mtcarz) # vector ds_percentiles(mtcarz$mpg) # vectors of different length disp <- mtcarz$disp[1:10] ds_percentiles(mtcarz$mpg, disp) # decimal places ds_percentiles(mtcarz, disp, hp, decimals = 3)# single column ds_percentiles(mtcarz, mpg) # multiple columns ds_percentiles(mtcarz, mpg, disp) # all columns ds_percentiles(mtcarz) # vector ds_percentiles(mtcarz$mpg) # vectors of different length disp <- mtcarz$disp[1:10] ds_percentiles(mtcarz$mpg, disp) # decimal places ds_percentiles(mtcarz, disp, hp, decimals = 3)
Creates bar plots if the data has categorical variables.
ds_plot_bar(data, ..., fill = "blue", print_plot = TRUE)ds_plot_bar(data, ..., fill = "blue", print_plot = TRUE)
data |
A |
... |
Column(s) in |
fill |
Color of the bars. |
print_plot |
logical; if |
# plot single variable ds_plot_bar(mtcarz, cyl) # plot multiple variables ds_plot_bar(mtcarz, cyl, gear) # plot all variables ds_plot_bar(mtcarz)# plot single variable ds_plot_bar(mtcarz, cyl) # plot multiple variables ds_plot_bar(mtcarz, cyl, gear) # plot all variables ds_plot_bar(mtcarz)
Creates grouped bar plots if the data has categorical variables.
ds_plot_bar_grouped(data, ..., print_plot = TRUE)ds_plot_bar_grouped(data, ..., print_plot = TRUE)
data |
A |
... |
Column(s) in |
print_plot |
logical; if |
# subset data mt <- dplyr::select(mtcarz, cyl, gear, am) # grouped bar plot ds_plot_bar_grouped(mtcarz, cyl, gear) # plot all variables ds_plot_bar_grouped(mt)# subset data mt <- dplyr::select(mtcarz, cyl, gear, am) # grouped bar plot ds_plot_bar_grouped(mtcarz, cyl, gear) # plot all variables ds_plot_bar_grouped(mt)
Creates stacked bar plots if the data has categorical variables.
ds_plot_bar_stacked(data, ..., print_plot = TRUE)ds_plot_bar_stacked(data, ..., print_plot = TRUE)
data |
A |
... |
Column(s) in |
print_plot |
logical; if |
# subset data mt <- dplyr::select(mtcarz, cyl, gear, am) # stacked bar plot ds_plot_bar_stacked(mtcarz, cyl, gear) # plot all variables ds_plot_bar_stacked(mt)# subset data mt <- dplyr::select(mtcarz, cyl, gear, am) # stacked bar plot ds_plot_bar_stacked(mtcarz, cyl, gear) # plot all variables ds_plot_bar_stacked(mt)
Creates box plots if the data has both categorical & continuous variables.
ds_plot_box_group(data, ..., print_plot = TRUE)ds_plot_box_group(data, ..., print_plot = TRUE)
data |
A |
... |
Column(s) in |
print_plot |
logical; if |
# subset data mt <- dplyr::select(mtcarz, cyl, disp, mpg) # plot select variables ds_plot_box_group(mtcarz, cyl, gear, mpg) # plot all variables ds_plot_box_group(mt)# subset data mt <- dplyr::select(mtcarz, cyl, disp, mpg) # plot select variables ds_plot_box_group(mtcarz, cyl, gear, mpg) # plot all variables ds_plot_box_group(mt)
Creates box plots if the data has continuous variables.
ds_plot_box_single(data, ..., print_plot = TRUE)ds_plot_box_single(data, ..., print_plot = TRUE)
data |
A |
... |
Column(s) in |
print_plot |
logical; if |
# plot single variable ds_plot_box_single(mtcarz, mpg) # plot multiple variables ds_plot_box_single(mtcarz, mpg, disp, hp) # plot all variables ds_plot_box_single(mtcarz)# plot single variable ds_plot_box_single(mtcarz, mpg) # plot multiple variables ds_plot_box_single(mtcarz, mpg, disp, hp) # plot all variables ds_plot_box_single(mtcarz)
Creates density plots if the data has continuous variables.
ds_plot_density(data, ..., color = "blue", print_plot = TRUE)ds_plot_density(data, ..., color = "blue", print_plot = TRUE)
data |
A |
... |
Column(s) in |
color |
Color of the plot. |
print_plot |
logical; if |
# plot single variable ds_plot_density(mtcarz, mpg) # plot multiple variables ds_plot_density(mtcarz, mpg, disp, hp) # plot all variables ds_plot_density(mtcarz)# plot single variable ds_plot_density(mtcarz, mpg) # plot multiple variables ds_plot_density(mtcarz, mpg, disp, hp) # plot all variables ds_plot_density(mtcarz)
Creates histograms if the data has continuous variables.
ds_plot_histogram(data, ..., bins = 5, fill = "blue", print_plot = TRUE)ds_plot_histogram(data, ..., bins = 5, fill = "blue", print_plot = TRUE)
data |
A |
... |
Column(s) in |
bins |
Number of bins in the histogram. |
fill |
Color of the histogram. |
print_plot |
logical; if |
# plot single variable ds_plot_histogram(mtcarz, mpg) # plot multiple variables ds_plot_histogram(mtcarz, mpg, disp, hp) # plot all variables ds_plot_histogram(mtcarz)# plot single variable ds_plot_histogram(mtcarz, mpg) # plot multiple variables ds_plot_histogram(mtcarz, mpg, disp, hp) # plot all variables ds_plot_histogram(mtcarz)
Creates scatter plots if the data has continuous variables.
ds_plot_scatter(data, ..., print_plot = TRUE)ds_plot_scatter(data, ..., print_plot = TRUE)
data |
A |
... |
Column(s) in |
print_plot |
logical; if |
# plot select variables ds_plot_scatter(mtcarz, mpg, disp) # plot all variables ds_plot_scatter(mtcarz)# plot select variables ds_plot_scatter(mtcarz, mpg, disp) # plot all variables ds_plot_scatter(mtcarz)
Compute the range of a numeric vector
ds_range(data, x = NULL)ds_range(data, x = NULL)
data |
A numeric vector or |
x |
Column in |
Range of x
# vector ds_range(mtcars$mpg) # data.frame ds_range(mtcars, mpg)# vector ds_range(mtcars$mpg) # data.frame ds_range(mtcars, mpg)
Returns the original positions of values in a vector.
ds_rindex(data, values)ds_rindex(data, values)
data |
a numeric vector |
values |
a numeric vector containing the values whose index is returned |
Positions refer to the vector passed in; missing values are not removed before the indices are computed.
Original positions of the values in data. Missing
values are ignored, and all matching positions are returned. In case
data does not contain a value, NULL is returned.
# returns index of 21 ds_rindex(mtcars$mpg, 21) # returns NULL ds_rindex(mtcars$mpg, 22)# returns index of 21 ds_rindex(mtcars$mpg, 21) # returns NULL ds_rindex(mtcars$mpg, 22)
Screen data and return details such as variable names, class, levels and
missing values. plot.ds_screener() creates bar plots to visualize
of missing observations for each variable in a data set.
ds_screener(data) ## S3 method for class 'ds_screener' plot(x, ...)ds_screener(data) ## S3 method for class 'ds_screener' plot(x, ...)
data |
A |
x |
An object of class |
... |
Further arguments to be passed to or from methods. |
ds_screener() returns an object of class "ds_screener".
An object of class "ds_screener" is a list containing the
following components:
Rows |
Number of rows in the data frame. |
Columns |
Number of columns in the data frame. |
Variables |
Names of the variables in the data frame. |
Types |
Class of the variables in the data frame. |
Count |
Length of the variables in the data frame. |
nlevels |
Number of levels of a factor variable. |
levels |
Levels of factor variables in the data frame. |
Missing |
Number of missing observations in each variable. |
MissingPer |
Percent of missing observations in each variable. |
MissingTotal |
Total number of missing observations in the data frame. |
MissingTotPer |
Total percent of missing observations in the data frame. |
MissingRows |
Total number of rows with missing observations in the data frame. |
MissingCols |
Total number of columns with missing observations in the data frame. |
# screen data ds_screener(mtcarz) ds_screener(airquality) # plot x <- ds_screener(airquality) plot(x)# screen data ds_screener(mtcarz) ds_screener(airquality) # plot x <- ds_screener(airquality) plot(x)
Compute the skewness of a probability distribution.
ds_skewness(data, x = NULL)ds_skewness(data, x = NULL)
data |
A numeric vector or |
x |
Column in |
Any NA values are stripped from x before computation
takes place. For non-missing observations, sample standard
deviation and , the
skewness is
This is the adjusted Fisher-Pearson standardized moment coefficient; it
matches e1071::skewness(x, type = 2) and the SAS/SPSS definition.
Sheskin, D.J. (2000) Handbook of Parametric and Nonparametric Statistical Procedures, Second Edition. Boca Raton, Florida: Chapman & Hall/CRC.
kurtosis
# vector ds_skewness(mtcars$mpg) # data.frame ds_skewness(mtcars, mpg)# vector ds_skewness(mtcars$mpg) # data.frame ds_skewness(mtcars, mpg)
Returns the standard error of mean.
ds_std_error(x)ds_std_error(x)
x |
A numeric vector. |
Missing values are removed before computation and the number of
non-missing observations is used. A vector with no non-missing
observations returns NA.
ds_std_error(mtcars$mpg)ds_std_error(mtcars$mpg)
Range of descriptive statistics for continuous data.
ds_summary_stats(data, ...)ds_summary_stats(data, ...)
data |
An object of type |
... |
Column(s) in |
summary
ds_freq_table ds_cross_table
# numeric data ds_summary_stats(mtcarz$mpg) # single variable ds_summary_stats(mtcarz, mpg) # multiple variables ds_summary_stats(mtcarz, mpg, disp, hp) # all variables ds_summary_stats(mtcarz)# numeric data ds_summary_stats(mtcarz$mpg) # single variable ds_summary_stats(mtcarz, mpg) # multiple variables ds_summary_stats(mtcarz, mpg, disp, hp) # all variables ds_summary_stats(mtcarz)
Returns the n highest/lowest observations from a numeric vector.
ds_tailobs(data, n, type = c("low", "high"), decimals = 2)ds_tailobs(data, n, type = c("low", "high"), decimals = 2)
data |
a numeric vector |
n |
number of observations to be returned |
type |
if |
decimals |
An option to specify the exact number of decimal places to use. The default number of decimal places is 2. |
Any NA values are stripped from data before computation takes place.
n highest/lowest observations from data
# 5 lowest observations ds_tailobs(mtcarz$mpg, 5) # 5 highest observations ds_tailobs(mtcarz$mpg, 5, type = "high") # specify decimal places to display ds_tailobs(mtcarz$mpg, 5, decimals = 3)# 5 lowest observations ds_tailobs(mtcarz$mpg, 5) # 5 highest observations ds_tailobs(mtcarz$mpg, 5, type = "high") # specify decimal places to display ds_tailobs(mtcarz$mpg, 5, decimals = 3)
Descriptive statistics for multiple variables.
ds_tidy_stats(data, ...)ds_tidy_stats(data, ...)
data |
A |
... |
Columns in |
A tibble.
ds_multi_stats() have been deprecated. Instead use ds_tidy_stats().
# all columns ds_tidy_stats(mtcarz) # multiple columns ds_tidy_stats(mtcarz, mpg, disp, hp)# all columns ds_tidy_stats(mtcarz) # multiple columns ds_tidy_stats(mtcarz, mpg, disp, hp)
A dataset containing demographic information and standardized test scores of high school students.
hsbhsb
A data frame with 200 rows and 10 variables:
id of the student
gender of the student
ethnic background of the student
socio-economic status of the student
school type
program type
scores from test of reading
scores from test of writing
scores from test of math
scores from test of science
scores from test of social studies
https://nces.ed.gov/surveys/hsb/
Copy of mtcars data set with modified variable types
mtcarzmtcarz
An object of class data.frame with 32 rows and 11 columns.