[Rcpp-devel] translate r to rcpp

Serguei Sokol serguei.sokol at gmail.com
Thu Oct 5 15:48:52 CEST 2017


Le 05/10/2017 à 14:55, Dirk Eddelbuettel a écrit :
> 
> On 5 October 2017 at 12:43, rihab boubakri wrote:
> | hello please can any one help me to change that function to rcpp or cxxfunction please
> |
> |     for(i in 1:length(datafi$p)){
> |     if(datafi$A[i] != "STOP"){
> |         datafi$tran[i]=matt[[datafi$p[i+1]]][datafi$A[i],datafi$A[i+1]]
> |      }
> |     }
> 
> What have you tried?  What failed?  What error did you get?  What result were
> you expecting?
At least one potential error jumps out at you. If "STOP" is not the last item in datafi$A,
you will have "index out of range" for datafi$p[i+1] and datafi$A[i+1] when i=length(datafi$p).

Serguei.

> 
> Most of us have real work to do so asking us for free code writing service is
> a wee bit much.
> 
> Dirk
> 



More information about the Rcpp-devel mailing list