data_summary: Data summary

Description Usage Arguments Details Value Examples

View source: R/data_summary.r

Description

Generate automatic data summaries for different types of data

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
  data_summary(input, ...)

  ## S3 method for class 'data.frame'
data_summary(input, at, show = TRUE)

  ## S3 method for class 'grouped_df'
data_summary(input, at, show = TRUE)

  ## S3 method for class 'numeric'
data_summary(input, show = TRUE)

  ## S3 method for class 'logical'
data_summary(input, show = TRUE)

  ## S3 method for class 'character'
data_summary(input, show = TRUE)

  ## S3 method for class 'factor'
data_summary(input, show = TRUE)

Arguments

input

Data that should be summarized, can be of class "data.frame", "grouped_df", "numeric", "logical", "character", "factor"

at

"character" or "integer" vector that identifies the variables that should be summarized (only for "data.frame" and "grouped_df" methods)

show

Indicator whether output should be returned or passed to "print"

Details

The function data_summary provides 11 columns of output for each variable selected in at:

The exact output for the function depends on the data provided as input:

Value

Summary statistics for the data provided as "input" and the variables selected in at. When the option show is set to TRUE the output is printed to the console. If the package knitr is available, the output is printed using knitr::kable. When show is set to FALSE the output is returned as data.frame or tibble (when package tibble is available).

Examples

1
2
3
4
5
  data <- supportR::create_data(n = 50)
  data$country <- as.factor(data$country)
  data_summary(data, at = c("firm_value", "female_ceo", "industry", "country"))
  data_summary(data$firm_value, show = FALSE)
  data_summary(dplyr::group_by(data, female_ceo), at = c("firm_value", "country"))

ha-pu/supportR documentation built on Sept. 13, 2020, 5:52 p.m.