<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
Thanks for that Dirk.<br><br>First comment: unless I'm mistaken there sounds like there could be significant overlap with the<br>thread http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2012-May/003802.html where<br>the comment came:<br>
<br>
<font style="" face="Courier New">"What we...need is to be able to

   <br>
1.  access the value of an Rcpp list entry by name.
   <br>
2.  recover the basic type, integer or floating point
  <br>
   3.  recover the dimensions
   <br>
4.  recover the values as a vector</font><font style="" face="Courier New">"<br>
</font>
<br>This feels almost the same as what I'm asking, in terms of getting information effectively from the<br>data frame...<br><br>Initially the situation struck me as very curious. You've gone to the trouble of passing a data frame<br>over to C++, and it's sat there with all the column names available, and all the data in it, and<br>presumably also all the data types. But you can't directly access the data. Ok, you've made me<br>accept this (however bizarre it may seem). So now I'm thinking: what is the best strategy to<br>get at the data in the general case?<br><br>Perhaps let me rephrase things as broadly as possible: what would be the best strategy to generate<br>from that data frame a collection of named objects that you CAN access? Let's say the notation<br>or object type is completely irrelevant to me - but somehow, I want to be able to access whatever was<br>in my "dragonCount" column using - in some way - the name "dragonCount" (not a column number).<br><br>Obviously, one strategy is to manually define individual vectors, one at a time, for each column in<br>the data frame. This is what I did in my example. But this doesn't seem like it should be the best<br>or most intelligent way. If there's 200 columns, that process requires 200 lines and looks pretty <br>horrendous. Even a n00b like me knows that's not how code should look.<br><br>So, even if the original Rcpp::DataFrame object doesn't permit access, surely there's some way <br>of solving the general case by setting up an object in C++ (vector of vectors?) and populating<br>it systematically from the DF object? Maybe by looping over the names in the DF object and adding<br>in the vectors one by one? I'm an R coder rather than a C++ coder so I'm coming to you fellows<br>cap in hand, asking whether this is possible.<br><br>I'm not asking for Rcpp to do this automatically - I'm simply asking how one should approach the<br>problem. Coming from the R side, I also genuinely think anyone who wishes to use Rcpp with large<br>data frames will be extremely interested in the answer.<br><br>Cheers for now,<br>Tim P<br><br>                                     </div></body>
</html>