On Fri, Oct 8, 2010 at 5:33 AM, Dirk Eddelbuettel wrote:
>
> On 8 October 2010 at 04:28, Christian Gunning wrote:
> | Yes, I've used this successfully. I have run into trouble extracting
> | elements of length>1 from lists with variable-length elements, e.g.
> | _mylist = list(a=1, b=1:3), mylist
Thanks again, Dirk.
full example (sorry for the verbose post):
library(inline)
library(Rcpp)
inc <- '
#include
#include
#include
using namespace arma;
using namespace cppbugs;
class TestModel: public MCModel {
public:
const mat& y; // given
const mat& X; // given
Normal b;
Uniform
Le 07/10/10 22:04, Koert Kuipers a écrit :
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
Not sure that I saw the original posting from Vinh but it may be
helpful to know that there is an example that uses Rcpp classes to do
much of packaging of the function, arguments, initial values, etc. in
the minqa package
On Fri, Oct 8, 2010 at 5:28 AM, Christian Gunning wrote:
>> Message: 2
>>
On 8 October 2010 at 04:28, Christian Gunning wrote:
| Yes, I've used this successfully. I have run into trouble extracting
| elements of length>1 from lists with variable-length elements, e.g.
| _mylist = list(a=1, b=1:3), mylist["a"] works but mylist["b"] is
| squirrely.
Please send a reproduc
Hi Vinh,
On 7 October 2010 at 21:41, Vinh Nguyen wrote:
| I'll pass the R list as an SEXP object and then use Rcpp to access that list:
| extern "C" SEXP MyCppFunc(..., SEXP _list){
| ...
| Rcpp::List list(_list) ;
| ...
| }
|
| Is the above the proper way to pass a list the Rcpp way? I've
Yes
> Message: 2
> Date: Thu, 7 Oct 2010 21:41:06 -0700
> From: Vinh Nguyen
> Subject: [Rcpp-devel] pass an R list as an argument and accessing
> elements of a list
> Dear Rcpp List,
>
> My goal is to write a generic C++ optimizing function (call it "optim"
> in this email) based on the