Skip to content
Prev 3142 / 63424 Next

tabulate

Bill Venables <William.Venables@cmis.CSIRO.AU> writes:
...
OK first, notice that I get:
[1] 3.38 0.00 3.38 0.00 0.00
[1] 2.12 0.00 2.12 0.00 0.00
[1] 1.19 0.00 1.20 0.00 0.00

so most of the time really goes into factor(). If one is careful about
the innards of table() one can shave the time for that to
[1] 0.66 0.01 0.67 0.00 0.00

Rather interestingly, the non constant time part of table would seem
equivalent to
[1] 0.25 0.00 0.25 0.00 0.00
[1] 0.07 0.00 0.07 0.00 0.00

Notice the huge difference in the two executions, indicating that the
number of garbage collections involved probably play a major role.

On the whole it doesn't really seem to be worth it to obtimize this
very heavily, but if you have any obvious improvements for factor()...