msberends / cleaner

Fast and Easy Data Cleaning (in R)

Home Page:https://msberends.github.io/cleaner

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

do not print the cum count in freq()

jukkiebah opened this issue · comments

hai

is it possible to print frequency tables using the freq() function, without a cum count column?

thanks

Hi @jukkiebah,

freq() is not part of the AMR package, it is part of the cleaner package so I moved the issue here.

What is the reason you would like to omit the cumulative count column? If you want to omit it for reporting, you can of course use base R or the dplyr package to remove it:

library(dplyr)
library(cleaner)

starwars %>%
  freq(gender)
#> Frequency table 
#> 
#> Class:      character
#> Length:     87
#> Available:  83 (95.40%, NA: 4 = 4.60%)
#> Unique:     2
#> 
#> Shortest:   8
#> Longest:    9
#> 
#>      Item           Count    Percent    Cum. Count    Cum. Percent
#> ---  -----------  -------  ---------  ------------  --------------
#> 1    masculine         66     79.52%            66          79.52%
#> 2    feminine          17     20.48%            83         100.00%

starwars %>%
  freq(gender) %>%
  select(-cum_count)
#>        item count   percent cum_percent
#> 1 masculine    66 0.7951807   0.7951807
#> 2  feminine    17 0.2048193   1.0000000

This will remove the nice printing structure, since the function is built around the requirement of the cum_count and cum_percent columns. So I'm curious what the win would be to remove them 🙂

Ok Thanks
That's not want i want indeed. Ill just do with all the columns then.
Thanks