diff --git a/R/modules-constructors.R b/R/modules-constructors.R index 206209e..0f97dda 100644 --- a/R/modules-constructors.R +++ b/R/modules-constructors.R @@ -162,6 +162,11 @@ ModuleCreateTableForOneVar <- function(x) { # Give a vector ## Reorder variables freq <- freq[c("n","miss","p.miss","level","freq","percent","cum.percent")] + + ## Ordering the levels of the categorical variable in the loop + ord = order(freq$percent,decreasing = TRUE) + ## ordreing the table of the categorical variable + freq = freq[ord,] ## Return result as a data frame return(freq)