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

Robert A'gata rhelpacc at gmail.com
Fri Nov 23 22:36:46 CET 2012


Hi,

I have a situation where I would like to create R data.frame/list
dynamically from the two event callbacks.
1) Event A: it tells what the table column names and types are.
2) Event B: it always follows A and is triggered when a new row of
table described in A becomes available.

Example of interfaces for both event callbacks are:

void onEventA(std::list< std::pair< std::string, int > > columnList)
{
   // columnList is a list containing a pair of column name and type enum
}

void onEventB( mydomain::tickEvent tickObj )
{
   // tickObj corresponds to a row in the event A callback argument.
it has function "getValue<T>(string ColName)" from which you can
retrieve the value from it
}

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.

Regards,

Robert


More information about the Rcpp-devel mailing list