[Rcpp-devel] Equivalent to the which function in Rcpp / Access to a data.frame's indices?
kevinushey at gmail.com
Fri Jul 18 22:15:36 CEST 2014
Sorry, Rcpp doesn't have vectorized subsetting for rows of a data.frame /
matrix. However, if you want columns, you can use vector subsetting:
But perhaps we can consider added 'rows', 'cols' helper methods that would
pull out rows and columns of a data.frame / matrix that satisfy some
On Fri, Jul 18, 2014 at 9:51 AM, Asis Hallab <asis.hallab at gmail.com> wrote:
> Dear Rcpp-Experts,
> in Rcpp I want to quickly identify matching rows in a data.frame.
> In R I would do the following:
> matching.rows <- my.data.frame[ which(
> my.data.frame$column.of.interest == 'value_of_interest' ), ]
> How to do something similar in Rcpp?
> If I am not mistaken R data.frames and matrices do have some implicit
> index, thta allows very fast identification of matching positions,
> don't they?
> If it helps I could do that on an Rcpp::Matrix instead of a DataFrame…
> Help will be much appreciated.
> Have a pleasant weekend, and
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Rcpp-devel