Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
daaronr opened this issue Jan 21, 2022 · 7 comments
Closed

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

daaronr opened this issue Jan 21, 2022 · 7 comments

Comments

@daaronr
Copy link

daaronr commented Jan 21, 2022

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
@jzadra
Copy link
Contributor

jzadra commented Jan 21, 2022

"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%

@daaronr
Copy link
Author

daaronr commented Jan 21, 2022 via email

@jzadra
Copy link
Contributor

jzadra commented Jan 21, 2022

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).

@daaronr
Copy link
Author

daaronr commented Jan 21, 2022 via email

@jzadra
Copy link
Contributor

jzadra commented Jan 22, 2022

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.

@daaronr
Copy link
Author

daaronr commented Jan 22, 2022 via email

@sfirke
Copy link
Owner

sfirke commented Jan 22, 2022

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.

@sfirke sfirke closed this as completed Jan 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants