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
_______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel