cont.var | R Documentation |
This function computes the mean (SD), median (IQR), Q1/Q3, min/max, and a count of missings for a continuous variable input, optionally stratified by another variable, and with the option to compute p-values.
cont.var(var, strat, dec, header, ptype, pname, cont.rmstat, vspace, output)
var |
Continuous variable input. Required. |
strat |
Column stratifying variable. Optional. |
dec |
Number of decimal places on summary statistics. Optional; defaults to 2. |
header |
Character vector providing a short variable description. Optional; defaults to variable name. |
ptype |
Statistical test for p-value. Optional; defaults to none. See |
pname |
If TRUE then the name of the statistical test used will be printed below the p-value (default). Optional. |
cont.rmstat |
Vector naming the statistics that should be removed from the summary data frame. Optional; defaults to none.
|
vspace |
TRUE for additional vertical whitespace between variables (default). Optional. |
output |
Output type passed from |
Note that warnings and errors beyond those automatically provided by some base R functions are not in place for the improper use of significance testing. For example, if a t-test is requested across more than two strata, the code will execute and the returned p-value will reflect a test of only the first two strata.
Returns a data frame of continuous summary statistics.
Erica Wozniak
Table1
cat.var
make.table
quick.table
stat.col
out.plain
out.latex
out.html
library(survival) # Default output cont.var(var = pbc$age, strat = pbc$sex ) # Naming options and p-value cont.var(var = pbc$age, strat = pbc$sex, header = "Age", ptype = "ttest" ) # Remove min/max and missing statistics, and test for p-value cont.var(var = pbc$age, strat = pbc$sex, header = "Age", ptype = "ttest", cont.rmstat = c("minmax", "miss"), pname = FALSE )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.