vtable
vtable copied to clipboard
vtable returns factor levels sorted alphabetically and not as the levels function reports them,
vtable returns factor levels sorted alphabetically and not as the levels function reports them, e,g: vtable: 'Daily' 'Rarely' 'Weekly' levels: "Rarely" "Weekly" "Daily"
Is there a way to make vtable report levels the same as R function levels. Thanks Miloš
Hi Milos, I cannot reproduce this issue. I get factor-order results for both vtable and sumtable. I wonder if somehow your variable is not stored as a factor despite having levels set? Can you share your code?
d = data.frame(A = factor(c('A','B','C'), levels = c('C','A','B')))
vtable::sumtable(d)
vtable::vtable(d)