Re: [Rd] dimnames incoherence?

2020-02-22 Thread Martin Maechler
> William Dunlap > on Fri, 21 Feb 2020 14:05:49 -0800 writes: > If we change the behavior NULL--[[--assignment from > `[[<-`(NULL, 1, "a" ) # gives "a" (*not* a list) > to > `[[<-`(NULL, 1, "a" ) # gives list("a") > then we have more consistency there

Re: [Rd] dimnames incoherence?

2020-02-21 Thread William Dunlap via R-devel
If we change the behavior NULL--[[--assignment from `[[<-`(NULL, 1, "a" ) # gives "a" (*not* a list) to `[[<-`(NULL, 1, "a" ) # gives list("a") then we have more consistency there *and* your bug is fixed too. Of course, in other situations back-compatibility would be

Re: [Rd] dimnames incoherence?

2020-02-19 Thread Martin Maechler
> Martin Maechler > on Wed, 19 Feb 2020 18:06:57 +0100 writes: > Serguei Sokol > on Wed, 19 Feb 2020 15:21:21 +0100 writes: >> Hi, >> I was bitten by a little incoherence in dimnames assignment or may be I >> missed some point. >> Here is the case. If I

Re: [Rd] dimnames incoherence?

2020-02-19 Thread William Dunlap via R-devel
How far would you like to go with the automatic creation of dimnames in nested replacement operations on arrays? It currently works nicely with [<- > a <- array(numeric(), dim=c(2,0,1)); dimnames(a)[3] <- list("One") > str(a) num[1:2, 0 , 1] - attr(*, "dimnames")=List of 3 ..$

Re: [Rd] dimnames incoherence?

2020-02-19 Thread Martin Maechler
> Serguei Sokol > on Wed, 19 Feb 2020 15:21:21 +0100 writes: > Hi, > I was bitten by a little incoherence in dimnames assignment or may be I > missed some point. > Here is the case. If I assign row names via dimnames(a)[[1]], when > nrow(a)=1 then an error is

[Rd] dimnames incoherence?

2020-02-19 Thread Serguei Sokol
Hi, I was bitten by a little incoherence in dimnames assignment or may be I missed some point. Here is the case. If I assign row names via dimnames(a)[[1]], when nrow(a)=1 then an error is thrown. But if I do the same when nrow(a) > 1 it's OK. Is one of this case works unexpectedly? Both?