Easily summarize quantitative data

Share:

Description

ezsummary_quantitative() summarizes quantitative data.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
ezsummary_quantitative(tbl, total = FALSE, n = FALSE, missing = FALSE,
  mean = TRUE, sd = TRUE, sem = FALSE, median = FALSE,
  quantile = FALSE, extra = NULL, digits = 3, rounding_type = c("round",
  "signif", "ceiling", "floor"), round.N = 3, flavor = c("long", "wide"),
  fill = 0, unit_markup = NULL)

ezsummary_q(tbl, total = FALSE, n = FALSE, missing = FALSE, mean = TRUE,
  sd = TRUE, sem = FALSE, median = FALSE, quantile = FALSE,
  extra = NULL, digits = 3, rounding_type = c("round", "signif",
  "ceiling", "floor"), round.N = 3, flavor = c("long", "wide"), fill = 0,
  unit_markup = NULL)

Arguments

tbl

A vector, a data.frame or a dplyr tbl.

total

a T/F value; total counts of records including both missing and read data records. Default is FALSE.

n

A T/F value; total counts of records that is not missing. Default is FALSE.

missing

a T/F value; total counts of records that went missing( NA). Default is FALSE.

mean

A T/F value; the average of a set of data. Default value is TRUE.

sd

A T/F value; the standard deviation of a set of data. Default value is TRUE.

sem

A T/F value; the standard error of the mean of a set of data. Default value is FALSE.

median

A T/F value; the median of a set of data. Default value is FALSE.

quantile

A T/F value controlling 5 outputs; the 0%, 25%, 50%, 75% and 100% percentile of a set of data. Default value is FALSE.

extra

A character vector offering extra customizability to this function. Please see Details for detail.

digits

A numeric value determining the rounding digits; Replacement for round.N. Default setting is to read from getOption().

rounding_type

A character string determining the rounding method; possible values are round, signif, ceiling and floor. When ceiling or floor is selected, digits won't have any effect.

round.N

Deprecated; Will change the value of rounding_type if used in this version.

flavor

A character string with two possible inputs: "long" and "wide". "Long" is the default setting which will put grouping information on the left side of the table. It is more machine readable and is good to be passed into the next analytical stage if needed. "Wide" is more print ready (except for column names, which you can fix in the next step, or fix in LaTex or packages like htmlTable). In the "wide" mode, the analyzed variable will be the only "ID" variable and all the stats values will be presented ogranized by the grouping variables (if any). If there is no grouping, the outputs of "wide" and "long" will be the same.

fill

If set, missing values created by the "wide" flavor will be replaced with this value. Please check spread for details. Default value is 0

unit_markup

When unit_markup is not NULL, it will call the ezmarkup function and perform column combination here. To make everyone's life easier, I'm using the term "unit" here. Each unit mean each group of statistical summary results. If you want to know mean and stand deviation, these two values are your units so you can put something like "[. (.)]" there #' @param P Deprecated; Will change the value of p_type if used in this version.

Examples

1
2
3
4
5
library(dplyr)
mtcars %>%
  group_by(am) %>%
  select(mpg, wt, qsec) %>%
  ezsummary_quantitative()