Hospital<-c("AA","BB","BB","CC","BB",
"AA", "CC", "BB", "CC", "DD")
`Disease stage`<-c("3","2","2","3","2","1","2","3","2","2")
Location<-c("B","A","B","A","C","B","B","B","C","A")
mydata<-data.frame(Hospital,`Disease stage`,Location)
library(tableone)
CreateTableOne(data = mydata)
n 10
Hospital (%)
AA 2 (20.0)
BB 4 (40.0)
CC 3 (30.0)
DD 1 (10.0)
Disease.stage (%)
1 1 (10.0)
2 6 (60.0)
3 3 (30.0)
Location (%)
A 3 (30.0)
B 5 (50.0)
C 2 (20.0)
I want to order the categories according to their frequencies for each variable. Is this possible directly with CreateTableone?