[Rcpp-devel] Efficient DataFrame access by row & column

Ken Williams Ken.Williams at windlogics.com
Wed Feb 20 00:46:03 CET 2013

> -----Original Message-----
> From: Dirk Eddelbuettel [mailto:edd at debian.org]
> Sent: Tuesday, February 19, 2013 5:38 PM
> To: Ken Williams
> Cc: Dirk Eddelbuettel; rcpp-devel at lists.r-forge.r-project.org
> Subject: RE: [Rcpp-devel] Efficient DataFrame access by row & column
> Ken,
> On 19 February 2013 at 23:24, Ken Williams wrote:
> | For context, the line that's failing is:
> |
> |      if(fabs(df(j,i)-df(j,last_i))>thresh) {
> You are relying on an implicit conversion here to make df(.,.) a double. The
> compiler tells you that it is trying sugar operators.  Sugar is good to have in
> Rcpp, but occassionally there is a cost. This may be one of those times.
> Try
>       double a = df(j,i);
>       double b = df(j,last_i);
>         if (fabs(a - b) > thresh) {
> and see if that works.

Unfortunately no, I get a similar error when I try that:

window.cpp:68:24: error: conversion from 'Rcpp::Vector<19>::Proxy {aka Rcpp::internal::generic_proxy<19>}' to 'double' is ambiguous
window.cpp:68:24: note: candidates are:
C:/mybin/R/R-2.15.2/library/Rcpp/include/Rcpp/vector/string_proxy.h:273:4: note: Rcpp::internal::generic_proxy<RTYPE>::operator int() const [with int RTYPE = 19]
C:/mybin/R/R-2.15.2/library/Rcpp/include/Rcpp/vector/string_proxy.h:272:4: note: Rcpp::internal::generic_proxy<RTYPE>::operator bool() const [with int RTYPE = 19]
C:/mybin/R/R-2.15.2/library/Rcpp/include/Rcpp/vector/string_proxy.h:267:26: note: Rcpp::internal::generic_proxy<RTYPE>::operator U() const [with U = double, int RTYPE = 19]

> Not every conceivable operation is implemented in Rcpp,

Of course. =)

> but we are always
> open to patches to make it more complete.

If I can get myself up to speed with my understanding, I'll be happy to contribute what I can.



CONFIDENTIALITY NOTICE: This e-mail message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution of any kind is strictly prohibited. If you are not the intended recipient, please contact the sender via reply e-mail and destroy all copies of the original message. Thank you.

More information about the Rcpp-devel mailing list