Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Use summary(CreateTableOne) in HTML Output

cloudy tech
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 17, 2022

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.

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events