Hi Romain, "bind" may be confusing to R users, because "cbind" and "rbind" exist in R and return matrices. In my opinion, "combine" is a better option. - Andreas On Thu, Dec 13, 2012 at 10:01 AM, Romain Francois
<romain at r-enthusiasts.com> wrote:
Hello, I'd like to add a functionality to "bind" vectors of the same type (well sugar expressions really, but let's say it is vectors for the sake of this email). So essentially I'd like something similar to what "c" does in R :
> c( letters, letters )
[1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" [20] "t" "u" "v" "w" "x" "y" "z" "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" [39] "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z" I don't want to call it "c", and I'd like suggestions : combine, bind ? The idea is to avoid writing code like this: CharacterVector x, y ; CharacterVector z( x.size() + y.size() ) ; int i=0; for( ; i<x.size(); i++) z[i] = x[i] ; for( int j=0; j<y.size(); i++, j++) z[i] = y[j] ; I know it is not a big deal for people to write this code, but for example this does not handle the names of the elements, ... and internally I can use more efficient code Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-enthusiasts.com blog: http://romainfrancois.blog.free.fr |- http://bit.ly/RE6sYH : OOP with Rcpp modules `- http://bit.ly/Thw7IK : Rcpp modules more flexible
_______________________________________________ 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
Andreas Alfons Faculty of Business and Economics, KU Leuven www.econ.kuleuven.be/andreas.alfons/public/