count(x, value = value) is currently restricted to length(value) = 1. It "shouldn't be too hard" to generalize this to also support length(value) > 1. Alternative name could be table2(x, values) which falls back to table() when values = NULL.
For performance reasons, it could be that length(value) == 1 should remain as it's currently implemented. Maybe it's also worth making length(value) == 2 and == 3 optimized using 2 and 3 internal variables.
count(x, value = value)
is currently restricted tolength(value) = 1
. It "shouldn't be too hard" to generalize this to also supportlength(value) > 1
. Alternative name could betable2(x, values)
which falls back totable()
whenvalues = NULL
.For performance reasons, it could be that
length(value) == 1
should remain as it's currently implemented. Maybe it's also worth makinglength(value) == 2
and== 3
optimized using 2 and 3 internal variables.Then, we could have:
See also https://twitter.com/henrikbengtsson/status/957462928784990209