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

improve warning for top_values in a multi-way tie #93

Open
zkamvar opened this issue Sep 27, 2019 · 0 comments
Open

improve warning for top_values in a multi-way tie #93

zkamvar opened this issue Sep 27, 2019 · 0 comments

Comments

@zkamvar
Copy link
Member

zkamvar commented Sep 27, 2019

The use of the phrase "first value" in the Warning message works when there's only a two way tie, but isn't technically correct when there's a three way tie. Illustrated below:

x <- sample(rep(c("a", "b", "c", "d", "e", "f"), c(3, 3, 2, 2, 2, 1)))
top_values(x, n = 3)
 [1] "other" "c"     "b"     "other" "a"     "c"     "other" "a"     "a"     "other" "other" "b"     "b"    
Warning message:
a tie among values (c, d, e) was broken by choosing the first value 
 
 top_values(x, n = 4)
[1] "other" "c"     "b"     "other" "a"     "c"     "d"     "a"     "a"     "d"     "other" "b"     "b"    
Warning message:
a tie among values (c, d, e) was broken by choosing the first value 

I think for the latter, the warning message should read something like:

Warning message:
a tie among values (c, d, e) was broken by choosing the first two values 

Although important to emphasise the behaviour's still correct (the code's outputting the result we're after) so absolutely no problem at all if you can't get to this before you head off on holiday! Sorry again for the late reply and hope you have a wonderful holiday :)

Originally posted by @cwhittaker1000 in #90 (comment)

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

1 participant