John Mount defends the honor of base R:
The graph summarizes the performance of four solutions to the “scoring logistic regression by hand” problem:
-
Optimized Base R: a specialized “pre allocate and work with vectorized indices” method. This is fast as it is able to express our particular task in a small number of purely base R vectorized operations. We are hoping to build some teaching materials about this methodology.
-
Idiomatic Base R (shown dashed): an idiomatic R method using
stats::aggregate()
to solve the problem. This method is re-plotted in both graphs as a dashed line and works as a good division between what is fast versus what is slow. -
data.table: a straightforward data.table solution (another possible demarcation between fast and slow).
-
dplyr (no grouped filter): a dplyr solution (tuned to work around some known issues).
Read the whole thing, including the comments section, where there’s a good bit of helpful back-and-forth.
Comments closed