Description Usage Arguments Details Value Examples
Generate automatic data summaries for different types of data
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)
|
input |
Data that should be summarized, can be of class |
at |
|
show |
Indicator whether output should be returned or passed to |
The function data_summary provides 11 columns of output for each variable selected in at:
Variable - variable name
Cluster - cluster for grouping
Type - variable type
n - number of non-missing observations
SD - standard deviation
Min. - minimum
1st Qu. - .25 percentile
Mean - mean
Median - median, .50 percentile
3rd Qu. - .75 percentile
Max. - maximum
Groups - number of distinct groups represented in the variable
The exact output for the function depends on the data provided as input:
data.frame - The summary is provided for each variables selected in at in a separate row, the summary statistics depend on the variable type
grouped_df - As for data.frame but the summary is provided for each group separately, the respective group is shown in the variable Cluster
numeric - All output columns except "Groups"
logical - All output columns
character - Only output columns Variable, Type, n, Groups
factor - As for character
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).
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"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.