Closed thibautjombart closed 5 years ago
Thanks for this! Would it be possible to add a more informative warning in in the following situation. Currently, if the
subset
argument is a vector ofFALSE
s, a cryptic warning like this gets returned:Error in names(object) <- nm : 'names' attribute [4] must be the same length as the vector [1]
Here's the code I used to generate that warning:
x <- c("a", "a", "a", "b", "b", "c", "d") dates <- as.Date(c("2019-09-09", "2019-09-09", "2019-09-10", "2019-09-10", "2019-09-11", "2019-09-11", "2019-09-12")) top_values(x, n = 1, subset = dates > as.Date("2019-09-12"))
Would it be possible to have a more informative warning in this context?
This should be fixed via 5a665048832f7baa62af2ac1247619d1a8afd7d1
> top_values(x, subset = FALSE)
Error in top_values.factor(factor(x), n = n, replacement = replacement, :
`subset` does not retain any input
This should address issue https://github.com/reconhub/linelist/issues/92
New version should be installable using:
Example of working code (see the end of the example in the doc)
Passes the check on: