sfirke/janitor

it labels the column 'percent'; it's not a percent

daaronr opened this issue · 7 comments

Feature requests

The column 'percent' should be called 'share' instead (or it should auto-multiply by 100)

Bug reports

Brief description of the problem

mtcars %>% tabyl(cyl)

outputs

 cyl  n percent
   4 11 0.34375
   6  7 0.21875
   8 14 0.43750

But 'percents' add up to 100, while these add up to 1.

IMO it should output

 cyl  n share
   4 11 0.34375
   6  7 0.21875
   8 14 0.43750

or

cyl  n percent
4 11  34.375
6  7  21.875
8 14  43.750

"percent" means per 100. A percent is the fraction of a value divided by 100. IE 45% is 45 per 100, or 45/100, which is .45.

mtcars %>% 
   tabyl(cyl) %>% 
   adorn_pct_formatting()

cyl  n percent
   4 11   34.4%
   6  7   21.9%
   8 14   43.8%

My understanding is that "57 per hundred" is the same as 57%. The % means "per hundred".

If you don't have the "%" symbol after the number, the correct way to represent it is as the fraction.

57% is just another way of writing 57/100.

If you take the % away from 57%, it's the same as taking the 100 away from 57/100. And 57/100 = .57 (you've removed the "/100" by doing the math).

Hmm. Yeah I see what you are saying. But regardless it would be a major breaking change to rename that column so I think you're on the right track with just modifying a function as you did.

I'm glad you like the package! You're correct and not the first person to suggest this. This has been discussed and unfortunately at this point I think the cost of fixing this outweighs the benefits. See #300 for more discussion.