[Rcpp-devel] Rcpp "version" of R's match function
Hadley Wickham
h.wickham at gmail.com
Thu Nov 15 15:39:36 CET 2012
>> PS. Would you be interested in a set of R functions that from a quick
>> skim of the R sources that I think could be much much faster if
>> implemented in Rcpp?
>
> Sure. Time I have available will decide what I do of the list ^^.
Here's the list:
rowsum.default (C)?
findInterval (C)?
tapply (R: split + lapply)
median.default
cut.default?
duplicated.data.frame
rank?
rle (R, 3 copies) ?
%in%
range.default
range.default is particularly bad because range uses internal S3
dispatch, it creates a copy of the vector if na.rm = TRUE, and it
calls min and max separately. I suspect it should be possible to
implement %in% more efficiently rather than match. Some of the others
(findInterval, cut, median) should be easy to implement with the STL,
but might not be that much faster than the existing C code.
Hadley
--
RStudio / Rice University
http://had.co.nz/
More information about the Rcpp-devel
mailing list