summarize_numeric {papeR} | R Documentation |
Produce Summary Tables for Data Sets
Description
The function produces summary tables for continuous
variables. The obtained tables can be used directly in R, with LaTeX
and HTML (by using the xtable
function) or Markdown
(e.g. by using the function kable
).
Usage
summarize_numeric(data,
variables = names(data), variable.labels = labels, labels = NULL,
group = NULL, test = !is.null(group), colnames = NULL,
digits = 2, digits.pval = 3, smallest.pval = 0.001,
sep = !is.null(group), sanitize = TRUE,
drop = TRUE, show.NAs = any(is.na(data[, variables])),
## additional specific arguments
count = TRUE, mean_sd = TRUE, quantiles = TRUE,
incl_outliers = TRUE, ...)
Arguments
data |
data set to be used. |
variables |
variables that should be included in the table.
For details see |
variable.labels , labels |
labels for the variables.
For details see |
group |
character specifying a grouping factor.
For details see |
test |
logical or charachter specifying test for group differences.
For details see |
colnames |
a vector of character strings of appropriate length.
For details see |
digits |
number of digits to round to. Per default all values are rounded to two digits. |
digits.pval |
number of significant digits used for p-values. |
smallest.pval |
determines the smallest p-value to be printed exactly.
For details see |
sep |
logical (default: |
sanitize |
logical (default: |
drop |
logical (default: |
show.NAs |
logical. Determines if the number of missings (NAs) is displayed as
a separate column. Per default, |
count |
(logical) indicator if number of complete cases ("n") should be
included in the table (default: |
mean_sd |
(logical) indicator if mean and standard deviation should be
included in the table (default: |
quantiles |
(logical) indicator if quantiles (including min and max) should be
included in the table (default: |
incl_outliers |
Per default we use |
... |
additional arguments. Currently not used. |
Value
A special data.frame
with additional class summary
containing the computed statistics is returned from function
summarize
. Addtional attributes required for the
xtable.summary
or print.xtable.summary
function are contained as attributes. These are extracted using the
function get_option
.
Author(s)
Benjamin Hofner
See Also
For details see link{summarize}
and link{summarize_factor}
.
Conversion to LaTeX tables can be done using
xtable.summary
and print.xtable.summary
.
Examples
if (require("nlme")) {
## Use dataset Orthodont
data(Orthodont, package = "nlme")
## Get summary for continuous variables
summarize(Orthodont, type = "numeric")
## Change statistics to display
summarize(Orthodont, quantiles = FALSE, type = "numeric")
summarize(Orthodont, quantiles = FALSE, count = FALSE, type = "numeric")
summarize(Orthodont, mean_sd = FALSE, type = "numeric")
## for more examples see ?summarize
}