Rcpp: Inconsistent behavior with proxy model
问题 This post discusses some issues with the proxy model for parameter passing in Rcpp. However, when I implemented this function: // [[Rcpp::export]] void test_size(NumericVector test){ NumericVector test2(test); NumericVector test3 = NumericVector::create(1,1,1,1,1); test2 = test3; Rf_PrintValue(test); } We get: > temp = c(2,2,2,2) > test_size(temp) [1] 2 2 2 2 So the problem is that the previous post and this book say that in this case test2 should be a pointer to the underlying SEXP object