View source: R/CreateSampleCharacteristicsTable.R
Creates the sample characteristics table. Wrapper of TableOne.
1 2 3 4 5 6 7 8 9 10 | CreateSampleCharacteristicsTable(study.sample, group = NULL,
variables = NULL, exclude.variables = NULL, include.overall = TRUE,
include.missing = TRUE, include.complete.data = FALSE, digits = 1,
codebook = NULL, only.codebook.variables = TRUE,
codebook.options = list(full.label.entry = "full.label",
abbreviated.label.entry = "abbreviated.label"), return.pretty = FALSE,
return.as.data.frame = TRUE, save.to.results = TRUE,
table.name = "sample.characteristics.table",
table.caption = "Sample characteristics", save.to.disk = FALSE,
file.format = "docx")
|
study.sample |
Data frame. The study sample. No default. |
group |
Character vector of length 1. The grouping variable. If NULL the table is not grouped. Defaults to NULL. |
variables |
Character vector. The names of variables to include in the table. If NULL all variables in study.sample are included. Defaults to NULL. |
exclude.variables |
Character vector. The names of variables to exclude from the table. If NULL no variables are excluded. Defaults to NULL. |
include.overall |
Logical vector of length 1. If TRUE an overall column is included in the tables. Used only if group is not NULL. Defaults to TRUE. |
include.missing |
Not currently used. Logical vector of length 1. If TRUE a column with the number ( included. Defaults to TRUE. |
include.complete.data |
Logical vector of length 1. If TRUE the final table has two columns, one with complete cases only and one with multiple imputed data. Only used if the data is detected as multiple imputed, i.e. includes the variables ".imp" AND ".id". Overrides group and include.overall. |
digits |
Numeric vector of length 1 greater than or equal to 0. Number of digits to use when rounding table entries. Defaults to 1. |
codebook |
A list or NULL. If a list is provided this list will be assumed to be a codebook, in the sense that it is a collection of variable descriptions. In other words, each entry is a description of a variable. The names of the first level entries of the list are assumed to be variable names. Must include at least two entries that define the full and abbreviated label of each variable respectively. Defaults to NULL. |
only.codebook.variables |
A logical vector of length 1. If TRUE only the variables defined in codebook are included in the table. The rows of the table are also in the same order as in the codebook. Only used if codebook is not NULL. Defaults to TRUE. |
codebook.options |
A list. The list can only include the entries full.label.entry and abbreviated.label.entry, which in turn should should be character vectors of length 1 specifying the names of the full and abbreviated label entries in the codebook. Defaults to list(full.label.entry = "full.label", abbreviated.label.entry = "abbreviated.label"). If codebook is NULL this option is ignored. |
return.pretty |
Logical vector of length 1. If TRUE the returned table object is made pretty by adding the caption and abbreviations. Defaults to FALSE. |
return.as.data.frame |
Logical vector of length 1. If TRUE the table is returned as a data.frame instad of a matrix. Defaults to TRUE. |
save.to.results |
Logical vector of length 1. If TRUE the table object is saved to a results file on disk using SaveToResults. Defaults to TRUE. |
table.name |
Character vector of length 1. The name of the table when passed to SaveToResults and saved to disk.. Deafults to "sample.characteristics.table". |
table.caption |
Character vector of length 1. The table caption. Deafults to "Sample characteristics". |
save.to.disk |
Logical vector of length 1. If TRUE the table object is saved to disk. Defaults to FALSE. |
file.format |
Character vector of length 1. The format in which to save the table to disk. Has to be one of c("pdf", "rmd", "docx"). Defaults to "docx". |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.