Re: [Rd] a fast table() for the 1D case

2013-09-16 Thread Hervé Pagès
Any chance some improvements can be made on table()? table() is probably one of the most used R functions when working interactively. Unfortunately it can be incredibly slow, especially on a logical vector where a simple sum() is hundred times faster (I actually got into the habit of using sum()

[Rd] a fast table() for the 1D case

2013-08-09 Thread Hervé Pagès
Hi, table1D() below can be up to 60x faster than base::table() for the 1D case. Here are the detailed speedups compared to base::table(). o With a logical vector of length 5M: 11x faster (or more if 'useNA="always"') o With factor/integer/numeric/char