build_row | R Documentation |
Summarize data into a data.frame with row(s). Includes optional stratification and null hypothesis testing using a factor or logical variable.
build_row(x, ...) ## S3 method for class 'data.frame' build_row( x, y = NA_real_, label = NULL, label.stat = TRUE, stat.pct.sign = FALSE, col.overall = TRUE, col.missing = FALSE, col.test = FALSE, digits = 1, ... ) ## S3 method for class 'numeric' build_row( x, y = NA_real_, label = NULL, label.stat = TRUE, stat = c("mean", "median"), stat.pct.sign = FALSE, col.overall = TRUE, col.missing = FALSE, test = c("anova", "kruskal", "wilcoxon"), col.test = FALSE, digits = 1, p.digits = 4, ... ) ## S3 method for class 'logical' build_row( x, y = NA_real_, label = NULL, label.stat = TRUE, inverse = FALSE, stat.pct.sign = FALSE, col.overall = TRUE, col.missing = FALSE, test = c("chisq", "fisher"), test.simulate.p = FALSE, col.test = FALSE, digits = 1, p.digits = 4, ... ) ## S3 method for class 'factor' build_row( x, y = NA_real_, label = NULL, label.stat = TRUE, stat.pct.sign = FALSE, col.overall = TRUE, col.missing = FALSE, test = c("chisq", "fisher"), test.simulate.p = FALSE, col.test = FALSE, digits = 1, p.digits = 4, ... )
x |
A data.frame, numeric, factor, or logical. Data to summarize. |
... |
Arguments passed to the appropriate S3 method. |
y |
A factor or logical. Data to optionally stratify |
label |
A character. A label for the summarized data. |
label.stat |
A logical. Append the summary statistic used to the label. |
stat.pct.sign |
A logical. Paste a percentage symbol with each frequency. frequency. |
col.overall |
A logical. Append a column with the statistic for all data.
If |
col.missing |
A logical. Append a column with counts of missing data. |
col.test |
A logical. Append a column with the name of the statistical test used. |
digits |
An integer. Number of digits to round to. |
stat |
A character. Name of the summary statistic to use. Supported options
include the mean ( |
test |
A character. Name of statistical test to compare groups.
Supported options: [continuous data] ANOVA linear model ( |
p.digits |
An integer. Number of p-value digits to report. |
inverse |
A logical. For logical data, report frequencies of the
|
test.simulate.p |
A logical. Whether to use Monte Carlo simulation of the p-value when testing nominal data. |
An object of class tbl_df
(tibble) summarizing the provided
data.
strata <- as.factor(datasets::mtcars$cyl) # Create a "count" row from a data.frame for a factor build_row(x = datasets::mtcars, y = strata) # Create a row summarizing a numeric by a factor build_row(label = 'MPG', x = as.numeric(datasets::mtcars$mpg), y = strata) # Create a row summarizing a logical by a factor build_row(label = 'VS', x = as.logical(datasets::mtcars$vs), y = strata) # Create a row summarizing a factor by a factor build_row(label = 'Carb', x = as.factor(datasets::mtcars$carb), y = strata)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.