Learn R Programming

tidystats (version 0.6.3)

describe_data: Calculate common descriptive statistics

Description

describe_data() returns a set of common descriptive statistics (e.g., number of observations, mean, standard deviation) for one or more numeric variables.

Usage

describe_data(data, ..., na.rm = TRUE, short = FALSE)

Arguments

data

A data frame.

...

One or more unquoted column names from the data frame.

na.rm

A boolean indicating whether missing values (including NaN) should be excluded in calculating the descriptives? The default is TRUE.

short

A boolean indicating whether only a subset of descriptives should be reported? If set to TRUE``, only the N, M, and SD will be returned. The default is FALSE`.

Details

The data can be grouped using dplyr::group_by() so that descriptives will be calculated for each group level.

Skew and kurtosis are based on the datawizard::skewness() and datawizard::kurtosis() functions (Komsta & Novomestky, 2015).

Examples

Run this code
describe_data(quote_source, response)

describe_data(quote_source, response, na.rm = FALSE)

quote_source |>
  dplyr::group_by(source) |>
  describe_data(response)

quote_source |>
  dplyr::group_by(source) |>
  describe_data(response, short = TRUE)

Run the code above in your browser using DataLab