Learn R Programming

tidystats (version 0.3)

describe_data: Calculate common descriptive statistics

Description

describe_data returns a set of common descriptive statistics (e.g., n, mean, sd) for numeric variables.

Usage

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

Arguments

data

A data frame.

...

One or more unquoted (numerical) column names from the data frame, separated by commas.

na.rm

Logical. Should missing values (including NaN) be removed?

Details

The data set can be grouped using dplyr's group_by so that descriptives will be calculated for each group level.

Skew and kurtosis are based on the skewness and kurtosis functions of the moments package (Komsta & Novomestky, 2015).

Examples

Run this code
# NOT RUN {
library(dplyr)

# 1 variable
describe_data(cox, avoidance)

# 1 variable, 1 group
cox %>%
  group_by(condition) %>%
  describe_data(avoidance)

# 2 variables
describe_data(cox, avoidance, anxiety)

# 2 variables, 1 group
cox %>%
  group_by(condition) %>%
  describe_data(avoidance, anxiety)

# 1 variable, 2 groups
cox %>%
  group_by(condition, sex) %>%
  describe_data(avoidance)

# 2 variables, 2 groups
cox %>%
  group_by(condition, sex) %>%
  describe_data(avoidance, anxiety)

# }

Run the code above in your browser using DataLab