Dirk, Thanks again! I thought I ought to let you know: the main problem was that my compilation still pointed to older versions of R and Rcpp that did not contain some of the additions in case. Goes to show!
But still some comments/questions below... > -----Original Message----- > From: Dirk Eddelbuettel [mailto:e...@debian.org] > Sent: zondag 15 mei 2011 21:22 > To: Nick Sabbe > Cc: 'Dirk Eddelbuettel'; rcpp-de...@r-forge.wu-wien.ac.at > Subject: RE: [Rcpp-devel] Matrix columns > > > Nick, > > I fear that you think that because data.frame is a preferred structure > in R, > it also must be in C++. That is not the case, and the reason is the > internal > representation of a data.frame at the C (and hence C++) level. You may > be > better off decomposing your data.frame into columns or different types > (in R > or C++) or just use a matrix if there is a common type. What I'm actually hoping to achieve is an improvement to the answer to my question in http://stackoverflow.com/questions/5980240/performance-of-rbind-data-frame (though in doubt that I will improve on it). Apart from that, I'm just trying to learn Rcpp. > > | > Why is retMat on the right-hand side if you try to fill it? Makes > no real > | sense. > | > | >From rcpp-quickref: > | // Reference the second column > | // Changes propagate to xx (same applies for Row) > | NumericMatrix::Column zzcol = xx( _, 1); > | zzcol = zzcol * 2; > | > | Only difference in my code was that I was assigning from a > NumericVector > | instead of from an altered version of the original > NumericMatrix::Column. Or > | am I mistaken here? I've put it here again: > | NumericVector curcol = df(i); > | NumericMatrix::Column cl = retMat( _, i); > | cl = curcol;//from rcpp-quickref, I understand this alters the > matrix? > > I believe you to be mistaken. Twice assigning overwrites. Feel free to > debug > and test to convince yourself. Then what's with the comment in rcpp-quickref (// Changes propagate to xx (same applies for Row))? As far as I recall (that old effective C++ has gathered quite a bit of dust by now), the first = is not an assignment but initialization. So I only assign once (in the last lign). But I'll debug and test to convince myself. > > | * is M(_,i) = V; any different from NumericVector cl = M(_,i);cl=V; ? > If so, > | how so? > > As I recall, the former ("one-step") created a compiler error as the > compiler > could not disambiguate some intermediate type. The second ("two-step") > worked, so I used that, So the difference is that one works :) [ In > theory, both should. Patches to make the former work are welcome. ] Truly lol. > > | * thanks for letting me know _ is part of sugar. I may be able to > figure out > | its use now, but isn't this worthy of a mention in rcpp-sugar.pdf? > > As I said a few days ago, patches which enhance documentation or code > are > always welcome and will always be properly credited (that is, if we > agree > with them and incorporate them). > Intriguingly, I could not find any information on how to get my suggested "patches" to you, besides a note on your site to "post them on the mailing list" (admittedly I could have looked better). Do I create a LaTeX file with additions to the helpfiles and send it here? Or is there a more formal (read: less annoying for you guys who would then still have to edit it until it fits the rest of the docs) way? I _do_ intend to try and improve the documentation, though I don't feel worthy to improve upon the implementation. Thanks again! Nick Sabbe -- ping: nick.sa...@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@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel