For SPSS users, here is a function that replicates SPSSĀ “freq” command. SPSS syntax mostly only reads the first 3 letters of a command so some readers may use “fre” in their SPSS syntax instead of “freq.”
freq <- function(x){ cbind( Freq = table(x), CumN = cumsum(table(x)), Percent = prop.table(table(x)), CumPer = cumsum(prop.table(table(x)))) } freq(mtcars$cyl)
## Freq CumN Percent CumPer ## 4 11 11 0.34375 0.34375 ## 6 7 18 0.21875 0.56250 ## 8 14 32 0.43750 1.00000