Hello list, looking at Rcpp::DataFrame in the gallery<http://gallery.rcpp.org/tags/dataframe/>I realized that I didn't know how to modify a DataFrame by reference. Googling a bit I found this post on SO<http://stackoverflow.com/questions/13773529/passing-a-data-table-to-c-functions-using-rcpp-and-or-rcpparmadillo>and this post on the archive<http://www.mail-archive.com/rcpp-devel@lists.r-forge.r-project.org/msg04919.html> . There is nothing obvious so I suspect I miss something big like "It is already the case because" or "it does not make sense because".
I tried the following which compiled but the data.frame object passed to updateDFByRef in R stayed untouched #include <Rcpp.h> using namespace Rcpp; // [[Rcpp::export]] void updateDFByRef(DataFrame& df) { int N = df.nrows(); NumericVector newCol(N,1.); df["newCol"] = newCol; return; } Could somebody explain me what I am missing or kindly point me to a document where I can find the explanation ? Cheers
_______________________________________________ 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