[Rcpp-devel] binding, combining vectors

John Merrill john.merrill at gmail.com
Thu Dec 13 16:25:34 CET 2012


What about 'concat', 'cat', or 'concatenate'?  The function concatenates
vectors, and 'concat' and 'cat' are well-known short forms of the word.
 (The Unix program 'cat' is so-named because it concatenates text files.)


On Thu, Dec 13, 2012 at 7:20 AM, Walter Mascarenhas <
walter.mascarenhas at gmail.com> wrote:

> Romain,
>
>    what about "join"?
>
>        walter.
>
>
> On Thu, Dec 13, 2012 at 1:15 PM, Andreas Alfons <
> andreas.alfons at kuleuven.be> wrote:
>
>> 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/
>> _______________________________________________
>> 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
>>
>
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20121213/a0bf4916/attachment.html>


More information about the Rcpp-devel mailing list