[Rd] paste(character(0), collapse="", recycle0=FALSE) should be ""

Hervé Pagès hp@ge@ @end|ng |rom |redhutch@org
Sun May 24 06:59:30 CEST 2020

On 5/23/20 17:45, Gabriel Becker wrote:
> Maybe my intuition is just 
> different but when I collapse multiple character vectors together, I 
> expect all the characters from each of those vectors to be in the 
> resulting collapsed one.

Yes I'd expect that too. But the **collapse** operation in paste() has 
never been about collapsing **multiple** character vectors together. 
What it does is collapse the **single** character vector that comes out 
of the 'sep' operation.


   paste(x, y, z, sep="", collapse=",")

is analogous to

   sum(x + y + z)

The element-wise addition is analog to the 'sep' operation.
The sum() operation is analog to the 'collapse' operation.


More information about the R-devel mailing list