[Rcpp-devel] pass an R list as an argument and accessing elements of a list

2010-10-07 Thread Vinh Nguyen
Dear Rcpp List, My goal is to write a generic C++ optimizing function (call it "optim" in this email) based on the Newton-Raphson algorithm.  I will be passing into the optimizing function 4 arguments: 1.  (pointer to) a function, "f1", to be optimized, 2.  an initial value/vector, 3.  the remaini

[Rcpp-devel] convert std::string to Rcpp::RawVector

2010-10-07 Thread Koert Kuipers
Hello all, I need to convert a std::string to a RAWSXP. I think i know hot do to this without Rcpp. It goes something like this (i haven't tested this): SEXP stringToRaw(std::string x) { SEXP y; PROTECT(y = allocVector(RAWSXP, x.length())); memcpy(RAW(y), x.data(), x.length()); UNPROTECT(1

Re: [Rcpp-devel] Filling NumericMatrix with NumericVectors with apply by row/column?

2010-10-07 Thread Romain Francois
Le 05/10/10 11:16, Christian Gunning a écrit : Sorry for slow reply. Or perhaps use the "_" thing : ret( i, _ ) = ... Is there documentation on _? No. It is used in a few places : Function rnorm( "rnorm" ) ; rnorm( 10, _["mean"] = 2.0 ) ; Language call( "rnorm", _["sd"] = 3.0 ) ; List: