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 :)
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:
I think for the latter, the warning message should read something like:
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 https://github.com/reconhub/linelist/pull/90#issuecomment-536005546