Description Usage Arguments Value Examples
View source: R/tidy.table.one.R
Produces a tbl1 object, which contains a two-way table grouped by the specificed grouping variable.
1 2 3 4 5 6 7 8 9 10 11 |
df |
A data frame or tibble with Hmisc-brand labels. |
grpvar |
The quoted name of a grouping variable that splits df into two cohorts. |
testTypes |
A vector of length nrow(df) containing "t" for a t-test or "w" for a Wilcoxon rank-sum test; applies only to continuous variables. Leave NULL to allow the function to choose for you based on the distance between the mean and median. |
d |
Number of significant digits to report in (non-p-value) numbers in the tbl1 object. |
p.digits |
Number of significant digits to report in p-values. |
fisher.simulate.p |
If TRUE use simulated p-values for Fisher's exact test. Default is FALSE. |
trunc_binary |
If TRUE print only one row for categorical variables with 2 levels. If FALSE, binary variables are printed on two rows, with the variable name and p-value on a row above. Default is TRUE. |
lbl |
LaTeX label to be passed to tx() for labeling the table in a LaTeX document. |
caption |
Text to be passed to tx() or md() to caption the table. |
A tbl1 object that can be formatted by tx() or md().
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | foo <- as_tibble(iris) %>%
filter(Species!="setosa") %>%
apply.labels(c("Sepal length",
"Sepal width",
"Petal length",
"Petal width",
"Species")) %>%
mutate(Species = fct_drop(Species))
md(tableone(foo, grpvar="Species"))
md(tableone(foo, grpvar="Species",
testTypes=c("t", "t", "t", "t", "t")))
md(tableone(foo, grpvar="Species",
testTypes=c("t", "t", "w", "w", "w")))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.