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

2020-05-28 Thread Hervé Pagès
Excellent! Thanks Martin. H. On 5/28/20 00:39, Martin Maechler wrote: Martin Maechler on Wed, 27 May 2020 13:35:44 +0200 writes: Hervé Pagès on Tue, 26 May 2020 12:38:13 -0700 writes: >> Hi Martin, On 5/26/20 06:24, Martin Maechler wrote: ... >>> >>> What about rem

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

2020-05-28 Thread Martin Maechler
> Martin Maechler > on Wed, 27 May 2020 13:35:44 +0200 writes: > Hervé Pagès > on Tue, 26 May 2020 12:38:13 -0700 writes: >> Hi Martin, On 5/26/20 06:24, Martin Maechler wrote: ... >>> >>> What about remaining back-compatible, not only to R 3.y.z >>> wit

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

2020-05-27 Thread Martin Maechler
> Hervé Pagès > on Tue, 26 May 2020 12:38:13 -0700 writes: > Hi Martin, On 5/26/20 06:24, Martin Maechler wrote: ... >> >> What about remaining back-compatible, not only to R 3.y.z >> with default recycle0=FALSE, but also to R 4.0.0 with >> recycle0=TRUE > Wh

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

2020-05-26 Thread Hervé Pagès
Hi Martin, On 5/26/20 06:24, Martin Maechler wrote: ... What about remaining back-compatible, not only to R 3.y.z with default recycle0=FALSE, but also to R 4.0.0 with recycle0=TRUE What back-compatibility with R 4.0.0 are we talking about? The 'recycle0' arg was added **after** the R 4.0.0

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

2020-05-26 Thread Martin Maechler
> Hervé Pagès > on Sun, 24 May 2020 14:22:37 -0700 writes: > On 5/24/20 00:26, Gabriel Becker wrote: >> >> >> On Sat, May 23, 2020 at 9:59 PM Hervé Pagès > > wrote: >> >> On 5/23/20 17:45, Gabriel Becker wrote: >> > Maybe my

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

2020-05-24 Thread Hervé Pagès
On 5/24/20 00:26, Gabriel Becker wrote: On Sat, May 23, 2020 at 9:59 PM Hervé Pagès > wrote: 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

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

2020-05-24 Thread Gabriel Becker
On Sat, May 23, 2020 at 9:59 PM Hervé Pagès wrote: > 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. >

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

2020-05-23 Thread Hervé Pagès
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()

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

2020-05-23 Thread Gabriel Becker
Brodie, A good point, but more analogous to what I'm concerned with is > sum(5, numeric(0)) [1] 5 Not 0 (the analogu of Herve's desired behavior). Best, ~G PS Brodie sorry for the double. On Fri, May 22, 2020 at 6:12 PM brodie gaslam wrote: > > On Friday, May 22, 2020, 6:16:45 PM EDT, Her

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

2020-05-23 Thread Gabriel Becker
Herve (et al.), On Fri, May 22, 2020 at 3:16 PM Hervé Pagès wrote: > Gabe, > > It's the current behavior of paste() that is a major source of bugs: > >## Add "rs" prefix to SNP ids and collapse them in a >## comma-separated string. >collapse_snp_ids <- function(snp_ids) >past

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

2020-05-23 Thread Hervé Pagès
On 5/22/20 18:12, brodie gaslam wrote: FWIW what convinces me is consistency with other aggregating functions applied to zero length inputs: sum(numeric(0)) ## [1] 0 Right. And 1 is the identity element of multiplication: > prod(numeric(0)) [1] 1 And the empty string is the identity elemen

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

2020-05-22 Thread brodie gaslam via R-devel
> On Friday, May 22, 2020, 6:16:45 PM EDT, Hervé Pagès > wrote: > > Gabe, > > It's the current behavior of paste() that is a major source of bugs: > >   ## Add "rs" prefix to SNP ids and collapse them in a >   ## comma-separated string. >   collapse_snp_ids <- function(snp_ids) >   paste("rs"

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

2020-05-22 Thread Hervé Pagès
Gabe, It's the current behavior of paste() that is a major source of bugs: ## Add "rs" prefix to SNP ids and collapse them in a ## comma-separated string. collapse_snp_ids <- function(snp_ids) paste("rs", snp_ids, sep="", collapse=",") snp_groups <- list( group1=c(55, 22, 200)

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

2020-05-22 Thread Gabriel Becker
I understand that this is consistent but it also strikes me as an enormous 'gotcha' of a magnitude that 'we' are trying to avoid/smooth over at this point in user-facing R space. For the record I'm not suggesting it should return something other than "", and in particular I'm not arguing that any

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

2020-05-22 Thread William Dunlap via R-devel
I agree with Herve, processing collapse happens last so collapse=non-NULL always leads to a single character string being returned, the same as paste(collapse=""). See the altPaste function I posted yesterday. Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, May 22, 2020 at 9:12 AM Hervé Pa

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

2020-05-22 Thread Hervé Pagès
I think that paste(c("a", "b"), NULL, c("c", "d"), sep = " ", collapse = ",", recycle0=TRUE) should just return an empty string and don't see why it needs to emit a warning or raise an error. To me it does exactly what the user is asking for, which is to change how the 3 arguments are r

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

2020-05-22 Thread Gabriel Becker
Hi Martin et al, On Thu, May 21, 2020 at 9:42 AM Martin Maechler wrote: > > Hervé Pagès > > on Fri, 15 May 2020 13:44:28 -0700 writes: > > > There is still the situation where **both** 'sep' and 'collapse' are > > specified: > > >> paste(integer(0), "nth", sep="", colla

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

2020-05-21 Thread William Dunlap via R-devel
> 1) Bill and Hervé (I think) propose that 'recycle0' should have > no effect whenever 'collapse = ' I think that collapse= should make paste() return a single string, regardless of the value of recycle0. E.g., I would like to see > paste0("X",seq_len(3),collapse=", ", recycle0=TRUE) [1] "X1,

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

2020-05-21 Thread Martin Maechler
> Hervé Pagès > on Fri, 15 May 2020 13:44:28 -0700 writes: > There is still the situation where **both** 'sep' and 'collapse' are > specified: >> paste(integer(0), "nth", sep="", collapse=",") > [1] "nth" > In that case 'recycle0' should **not** be ignored i.e.

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

2020-05-15 Thread Hervé Pagès
There is still the situation where **both** 'sep' and 'collapse' are specified: > paste(integer(0), "nth", sep="", collapse=",") [1] "nth" In that case 'recycle0' should **not** be ignored i.e. paste(integer(0), "nth", sep="", collapse=",", recycle0=TRUE) should return the empty string

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

2020-05-15 Thread Gabriel Becker
Hi all, This makes sense to me, but I would think that recycle0 and collapse should actually be incompatible and paste should throw an error if recycle0 were TRUE and collapse were declared in the same call. I don't think the value of recycle0 should be silently ignored if it is actively specified

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

2020-05-15 Thread Hervé Pagès
Totally agree with that. H. On 5/15/20 10:34, William Dunlap via R-devel wrote: I agree: paste(collapse="something", ...) should always return a single character string, regardless of the value of recycle0. This would be similar to when there are no non-NULL arguments to paste; collapse="." gi

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

2020-05-15 Thread William Dunlap via R-devel
I agree: paste(collapse="something", ...) should always return a single character string, regardless of the value of recycle0. This would be similar to when there are no non-NULL arguments to paste; collapse="." gives a single empty string and collapse=NULL gives a zero long character vector. > pa

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

2020-05-03 Thread suharto_anggono--- via R-devel
I was wrong, as I didn't actually try and didn't read the documentation carefully. I thought that ' zero-length arguments being recycled to "" ' happens when recycle0 = TRUE. It is actually the opposite. Everywhere in my previous message, recycle0 = FALSE should be recycle0 = TRUE. I really th

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

2020-05-02 Thread Martin Maechler
> suharto anggono--- via R-devel > on Fri, 1 May 2020 03:05:37 + (UTC) writes: > 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-leng

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

2020-04-30 Thread suharto_anggono--- via R-devel
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 = "", recycle