Description Usage Arguments Value Examples
Create descriptive tables
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | create_table1(
df,
headvar,
rowvars,
headvar_levels = NULL,
levels_order = NULL,
rowvar_labels = NULL,
headvar_na_level = "Missing",
file_name = "mytable",
header = "add span row title",
digits_num = 1L,
do_test = FALSE,
col_total = FALSE,
numvar_stats = c("meansd", "Nmiss"),
catvar_stats = c("countrowpct"),
stats_labels = list(Nmiss = "(Missing)"),
out_type = "docx",
font_size = 11,
font_family = "Arial",
...
)
|
df |
a dataframe |
headvar |
The variable name that you want your descriptive statistics stratified by (outcome or exposure variable). |
rowvars |
a vector explanatory variables (in the order you want them to appear in the table) example: c("age", "sex", "income") |
headvar_levels |
labels to be used for each level of head variable (eg: c("Yes"= "1","No"= "0", "Missing"= NA)) |
levels_order |
order of columns from left to right (eg: c("No", "Yes")) |
rowvar_labels |
Labels for explanatory variables (in correct order) example: c("Age (yr)", "Gender", "Monthly income") |
headvar_na_level |
How to name NA level of head variable (Eg: "Missing") |
file_name |
Name of the .docx file contain the table |
header |
Spanning header for the head variable columns |
digits_num |
Number of digits for numerical values |
do_test |
TRUE if you want to perform statistical analyses (eg: "chi", "anova", "kwt", ..etc) can specify tets with additional arguments (?arsenal::tableby.control) |
col_total |
Total for columns if TRUE |
numvar_stats |
Stats to display for numerical variables |
catvar_stats |
Stats to display for categorical variables |
stats_labels |
List of labels for respective stats |
out_type |
select "pdf" or "docx" |
font_size |
change font size (default 11) |
font_family |
change font family "Arial" is default |
... |
Takes any argument for the arsenal::tableby.control() function |
A .docx document with the table
1 2 3 4 5 6 7 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.