Description Usage Arguments Author(s) Examples
View source: R/baselineTable.R
This function creates a baseline table including descriptive statistics and automates work for a "Table 1" in scientific publications.
1 2 3 4 5 6 7 8 9 10 11 |
data |
Data needs to be entered that includes relevant variables for the baseline table |
vars |
Vector of variables to be included as rows for baseline Table |
labels |
Vector of labels to be set in rows for baseline Table. Needs to be the same length as vars. Defaults to vars values. |
grouping.var |
Optional variable name if you want to include extra rows (and statistical tests) for baseline variables split by groups. |
round_dec |
Number of decimal spaces to-be-included in baseline Table. Default is 2 |
placeholder |
The placeholder can be specified with indents descriptive statistics labels (e.g., Mean (SD)) by a given string. The default is " " (i.e., three spaces). |
welch.test |
If grouping.var is specified and includes two groups only, The Welch test will be used to test for significant differences between groups on continuous variables. Default is FALSE. |
na.statistics |
Should Missing value estimates be included in the output? Default is "all"; i.e., to provide all missingness statistics. Other options include "if.applicable" and "none". "if.applicable" includes missingness statistics for those variables, where NAs are present. |
print.vars |
Should variable names be included in the output (in addition to labels)? Default is FALSE. |
Nils Kappelmann
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | data("airquality")
airquality$Period = ifelse(airquality$Month %in% 5:7, "Early Summer", "Late Summer")
baselineTable(data = airquality,
vars = c("Ozone", "Solar.R",
"Wind", "Temp", "Period"))
baselineTable(data = airquality,
vars = c("Ozone", "Solar.R",
"Wind", "Temp", "Period"),
labels = c("Ozone (ppb)", "Solar R (lang)",
"Wind (mph)", "Temperature (degrees F)", "Period"))
baselineTable(data = airquality,
vars = c("Ozone", "Solar.R", "Wind", "Temp"),
labels = c("Ozone (ppb)", "Solar R (lang)",
"Wind (mph)", "Temperature (degrees F)"),
grouping.var = "Period", round_dec = 1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.