I'm using tableone to create summary tables. Some of my data is categorical, some is continuous that requires mean/sd or median/IQR depending on the variable. While the output I get is technically correct, it is pretty ugly looking and doesn't print into rmarkdown well. I had previously used table1 which looked better, but didn't give me mean/sd vs median/IQR like I needed.
My inputs: full_baseline_variables is a character vector with all the column names I need. Class is a variable in outcomes that defines each of my subgroups. Outcomes is a dataframe full_categorical_baseline is a character vector with the subset of variables that are categorical.
tab1 <- CreateTableOne(vars = full_baseline_variables, strata = "Class", data = outcomes, factorVars = full_categorical_baseline)
If I just print the above, it prints everything as mean/sd. I need a few variables as median/IQR, so I've created an additional character vector to put into the print function.
table1 <- print(tab1, nonnormal = full_medians_baseline)
The output I get is correct but is hard to read. Does anyone have suggestions of how to take the tab1 output and make a nicer table than with the print function?