[Rcpp-devel] data frame construction error
Dirk Eddelbuettel
edd at debian.org
Thu Mar 3 18:10:31 CET 2011
Hi Robin,
On 3 March 2011 at 17:22, Robin Aly wrote:
| Hi,
|
| I am building a Rcpp wrapper for the Information Retrieval package Lemur.
|
| For this, I need to construct a data frame of a dynamic number of columns.
|
| In my code, I do the following (condensed view):
|
| SEXP result=R_NilValue;
| std::vector<std::vector<COUNT_T>*> tfs(iters.size());
| tfs[i] is a numeric vector N elementer
| for (int i=iters.size()-1;i>=0;i--) {
| result=grow(_[tstem] = *tfs[i],result);
| }
|
| result=grow(_["DOCID"] = did,result);
|
| DataFrame res(::Rf_lcons( ::Rf_install( "data.frame"), result));
That is somewhat unusual usage.
You should not have to resort to Rf_lcons and Rf_install at the user level.
| Suppose now, both did and tfs[i] have N entries. Now if I select data
| such that N is small than 10000 everything works. However if I choose
| N bigger, I get the following error message.
|
| terminate called after throwing an instance of 'Rcpp::not_compatible'
| what(): could not convert using R function : as.data.frame
| Aborted
|
| I tried a lot of debugging and I don't find any structural differences
| with the
| additional data.
Can you provide a reproducible (mock) example? There is no built-in size
limit you should hit apart from whatever limits your available ram imposes
etc.
I have written code which returns data frame objects with a variable number
of columns and don't see how how any set size should matter.
You can also try a list type first if you find that easier and call
as.data.frame() once in R.
Dirk
| Would be great, if someone has an idea.
| Robin
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the Rcpp-devel
mailing list