Re: [R] Rcpp, function signature
On 27 Aug 2015, at 17:40 , Dirk Eddelbuettel e...@debian.org wrote: Michael Meyer via R-help r-help at r-project.org writes: I am an (very) grateful user of Rcpp. Glad to hear that! But you are on the wrong mailing list. Please ask on rcpp-devel. But for the benefit of the rest of us: A NumericVector is a pointer, right? -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Rcpp, function signature
peter dalgaard pdalgd at gmail.com writes: But for the benefit of the rest of us: A NumericVector is a pointer, right? Effectively even though it is not treated as one by the users. But you know what P in SEXP stands for, and Rcpp objects really are what we call proxy objects for the respective underlying SEXP objects. Searching the rcpp-devel list archives for the clone() function will bring a number of preceding discussions. As I said in the previous email, this list is not the best place to discuss Rcpp matters --- rcpp-devel is. Please feel free to bring follow-up questions there. Dirk __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Rcpp, function signature
Greetings, I am an (very) grateful user of Rcpp. As such I defined a function // [[Rcpp::export]] NumericVector leftShift(NumericVector x){ for(int i=0;in-1;i++) x[i]=x[i+1]; return x; } expecting this function not to affect the parameter x outside the function body as it is passed in by value. However subsequent tests showed that it does affect x. What is going on here? Is sourceCpp rewriting this code in somne fashion?? Michael Meyer __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Rcpp, function signature
Michael Meyer via R-help r-help at r-project.org writes: I am an (very) grateful user of Rcpp. Glad to hear that! But you are on the wrong mailing list. Please ask on rcpp-devel. Dirk __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.