Modifies tabulate to work with non-positive integers too.
TabulateInt(vec)
vec | The input vector |
---|
A named integer vector. There is a bin for each of the values 1, ..., nbins.
The behavior on non-integers might be somewhat unpredictable, but should
be somewhat like using table(cut(...))
with breaks being from the minimum
to the maximum + 1. See the "Examples" section.
Ananda Mahto
#> -5 -4 -3 -2 -1 0 1 2 3 4 5 #> 2 1 0 0 0 3 2 1 1 0 1#> [1] 2 1 1 0 1table(x)#> x #> -5 -4 0 1 2 3 5 #> 2 1 3 2 1 1 1#> #> -5 -4 -3 -2 -1 0 1 2 3 4 5 #> 2 1 0 0 0 3 2 1 1 0 1#> -2.2146998871775 -1.2146998871775 -0.2146998871775 0.7853001128225 #> 1 5 9 5#> #> [-2.21,-1.21] (-1.21,-0.215] (-0.215,0.785] (0.785,1.79] #> 1 5 9 5