Skip to content

[Rcpp-devel] DataFrame -> dims protected

2 messages · Nick Sabbe, Dirk Eddelbuettel

#
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?

 

Nick Sabbe

--

ping: nick.sabbe at ugent.be

link:  <http://biomath.ugent.be/> http://biomath.ugent.be

wink: A1.056, Coupure Links 653, 9000 Gent

ring: 09/264.59.36

 

-- Do Not Disapprove

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110513/281e6472/attachment.htm>
#
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