[Rcpp-devel] Dynamically creating data.frame/list (of vectors)

Dirk Eddelbuettel edd at debian.org
Mon Nov 26 21:55:57 CET 2012

On 26 November 2012 at 12:41, Davor Cubranic wrote:
| On 2012-11-23, at 1:36 PM, Robert A'gata wrote:
| > Inside onEventA, I'd like to be able to create a blank data.frame or
| > list with zero length vector. Once my data frame or list object is
| > constructed, I'd like to append a new row to it each time onEventB is
| > invoked. How can I achieve this in Rcpp? Thank you.
| Can you possibly stay in STL and keep rows in std::list, and only construct a Rcpp::DataFrame before you return to R?

Seconded -- meant to reply as well and got side-tracked.  

That's why I once did to gather data from a tick data plant. I just grew
everything (on callbacks from the ticker database system) in a stateful C++
class, and then transformed into Rcpp types before returning the query to R.

I knew how many columns I'd get at the beginning of the result set, and could
then grew them as results came in.  Was a nice solution and better than what
the vendor offered via ODBC :)


Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com  

More information about the Rcpp-devel mailing list