[Rcpp-devel] DataFrame -> dims protected

Dirk Eddelbuettel edd at debian.org
Fri May 13 19:00:33 CEST 2011


On 13 May 2011 at 16:44, Nick Sabbe wrote:
| Dear all,
| 
|  
| 
| I?m new to Rcpp (see also my previous message).
| 
| I?m trying to do some things to a data.frame passed in as a parameter.
| 
| One of the first things I need is the size of this data.frame, and I found the,
| unfortunately protected, member dims which returns just that.
| 
| Now, I can simply do what?s in its code, but it made me wonder: what is the
| reason that this method is protected?

Rcpp::DataFrame is really just a glorified Rcpp::List (as the R type itself
is also 'just' a list with magic and names etc). So think of it as a
collection of columns.

Was your real whether you can change the size of an existing data.frame at
the C++ level?   No, not easily.  You have to copy all column over and modify
them one by one.

Dirk

| 
|  
| 
| Nick Sabbe
| 
| --
| 
| ping: nick.sabbe at ugent.be
| 
| link: http://biomath.ugent.be
| 
| wink: A1.056, Coupure Links 653, 9000 Gent
| 
| ring: 09/264.59.36
| 
|  
| 
| -- Do Not Disapprove
| 
|  
| 
| 
| ----------------------------------------------------------------------
| _______________________________________________
| 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

-- 
Gauss once played himself in a zero-sum game and won $50.
                      -- #11 at http://www.gaussfacts.com


More information about the Rcpp-devel mailing list