Hi all. I'm writing an Rcpp module an would like to return as one element of the RcppResultSet list a list whose elements are vectors. E.g., .Call("myfunc")$foo
should be something like:
[[1]]
[1] 1
[[2]]
[1] 1 1
[[3]]
[1] 1 1 1
(the exact numbers are not important here). The issue is that I don't know the right Rcpp way of doing this. I tried passing a vector<vector<int> >
but this constructs a matrix by silently taking the length of the first vector as the width (even if the matrix is ragged!). I've tried constructing an RcppList
but have a hard time casting various objects (like RcppVector
) safely into SEXP
s.
Anyone have tips on best practices for dealing with complicated structures such as lists of vectors in Rcpp?