KreateTableOne: Create a table of descriptive statistics formatted for...

View source: R/KreateTableOne.R

KreateTableOneR Documentation

Create a table of descriptive statistics formatted for knitr::kable

Description

KreateTableOne is a wrapper for tableone::CreateTableOne which formats the original plain text table as a data.frame of character columns. KnitableTableOne is a wrapper for tableone::print.TableOne which allows for more versatility in printing options. The output of both functions can be printed in an RMarkdown document in a number of ways, e.g., using knitr::kable. svyKreateTabeOne does the same with tableone::svyCreateTableOne for complex survey data.

Usage

KreateTableOne(...)

svyKreateTableOne(...)

KnitableTableOne(x, ...)

Arguments

...

Parameters to be passed to tableone::CreateTableOne (KreateTableOne) or tableone::print.TableOne (KnitableTableOne).

x

A TableOne object created from tableone::CreateTableOne.

Details

These are very hacky functions. If used within an RMarkdown document, KreateTableOne and KnitableTableOne should be called in a code chunk with results='hide' to hide the plain test results printed from tableone::CreateTableOne. The resulting data frame should be saved as an object and used in a second code chunk for formatted printing. Suggestions for improvement are welcomed.

The function is written to work with knitr::kable, but should be able to work with other functions such as xtable::xtable.

Value

Returns a data frame of character columns.

See Also

CreateTableOne print.TableOne

Examples

table1 = KreateTableOne(data=mtcars, strata='am', factorVars='vs')
table1
knitr::kable(table1)


tloux/tldr documentation built on April 21, 2024, 12:38 p.m.