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

suh@rto_@@ggo@o m@iii@g oii y@hoo@com suh@rto_@@ggo@o m@iii@g oii y@hoo@com
Fri May 1 05:05:37 CEST 2020


Without 'collapse', 'paste' pastes (concatenates) its arguments elementwise (separated by 'sep', " " by default). New in R devel and R patched, specifying recycle0 = FALSE makes mixing zero-length and nonzero-length arguments results in length zero. The result of paste(n, "th", sep = "", recycle0 = FALSE) always have the same length as 'n'. Previously, the result is still as long as the longest argument, with the zero-length argument like "". If all og the arguments have length zero, 'recycle0' doesn't matter.

As far as I understand, 'paste' with 'collapse' as a character string is supposed to put together elements of a vector into a single character string. I think 'recycle0' shouldn't change it.

In current R devel and R patched, paste(character(0), collapse = "", recycle0 = FALSE) is character(0). I think it should be "", like paste(character(0), collapse="").

paste(c("4", "5"), "th", sep = "", collapse = ", ", recycle0 = FALSE)
is
"4th, 5th".
paste(c("4"     ), "th", sep = "", collapse = ", ", recycle0 = FALSE)
is
"4th".
I think
paste(c(        ), "th", sep = "", collapse = ", ", recycle0 = FALSE)
should be
"",
not character(0).



More information about the R-devel mailing list