[Rcpp-devel] add new components to list without specifying list size initially

2011-08-11 Thread Walrus Foolhill
Hello, I need to create a list and then fill it sequentially by adding components in a for loop. Here is an example that works: library(inline) src <- ' Rcpp::List mylist(2); for(int i=0; i<2; ++i) mylist[i] = i; mylist.names() = CharacterVector::create("a","b"); return mylist; ' fun <- cxxfunct

Re: [Rcpp-devel] Overloaded constructors?

2011-08-11 Thread Christian Gunning
> class A { > public: > A(int argument) {} > A(std::string name) {} > }; > > Now, given such a class - is there a way to distinguish the two constructors? > The way I understand the code in the Rcpp module is to allow for different > constructors with different numbers of arguments, but overloade

Re: [Rcpp-devel] add new components to list without specifying list size initially

2011-08-11 Thread Dirk Eddelbuettel
On 11 August 2011 at 03:06, Walrus Foolhill wrote: | Hello, | I need to create a list and then fill it sequentially by adding components in a | for loop. Here is an example that works: | | library(inline) | src <- ' | Rcpp::List mylist(2); | for(int i=0; i<2; ++i) |   mylist[i] = i; | mylist.nam

Re: [Rcpp-devel] add new components to list without specifying list size initially

2011-08-11 Thread Walrus Foolhill
Ok, thanks for your answer, but I wasn't clear enough. So here are more details of what I want to do. I have one list named "probes": probes <- list(chr1=data.frame(name=c("p1","p2"), start=c(81,95), end=c(85,100), stringsAsFactors=FALSE)) I also

Re: [Rcpp-devel] add new components to list without specifying list size initially

2011-08-11 Thread Dirk Eddelbuettel
Howdy, On 11 August 2011 at 20:44, Walrus Foolhill wrote: | Ok, thanks for your answer, but I wasn't clear enough. So here are more details | of what I want to do. | | I have one list named "probes": | probes <- list(chr1=data.frame(name=c("p1","p2"), | start=c(81,95), |   

[Rcpp-devel] Hello world for Rcpp modules

2011-08-11 Thread Chris DuBois
Hi all, I've created a package using Rcpp.package.skeleton("pkg",module=TRUE). If I create a file R/hello_world2.R with the following show(World) b <- new(World) b$greet() b$set("hello everybody") b$greet() rm(b) then I receive an "execution halted" error when I try to compile the package using

Re: [Rcpp-devel] add new components to list without specifying list size initially

2011-08-11 Thread Walrus Foolhill
Ok, I started with smaller examples. I understand more or less how to manipulate IntegerVectors, but not StringVectors (see below), and thus I can't even start manipulating a simple list of StringVectors. Even so I looked at mailing lists, StackOverflow, package pdf, source code on R-Forge... The