I use the CreateTableOne function to create a table for descriptive statistics - as an example, I used the mtcars dataset (and modified two variables to a factor to simulate categorical variables).
library(tableone)
mydata <- mtcars
mydata$gear <- as.factor(mydata$gear)
mydata$carb <- as.factor(mydata$carb)
VarsForTableOne <- c("mpg", "cyl", "disp", "hp", "drat", "wt", "gear", "carb")
myTableOne <- CreateTableOne(vars = VarsForTableOne, data = mydata, strata = "vs")
summary(myTableOne)
myTableOne$ContTable
myTableOne$CatTable
Now I would like to get a table for the data with continuous aspects (min, mean, median, max, quartiles) and categorical data (percentage) with each characteristic per variable.
summary(myTableOne) generates all the information which is interesting for me, but myTableOne$ContTable and myTableOne$CatTable not enough. Is there a way to customize the output of CreateTableOne?
In the end, I would like to get a table that can be formatted as HTML in a Markdown and/or copied to Excel.
Thanks for any help!
-------------------
code from exploratory testing tools.