[Rd] dimnames incoherence?
m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Wed Feb 19 18:06:57 CET 2020
>>>>> Serguei Sokol
>>>>> on Wed, 19 Feb 2020 15:21:21 +0100 writes:
> 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)[], 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? Neither?
> dimnames(a)[]="a" # error: 'dimnames' must be a list
> dimnames(aa)[]=c("a", "b") # OK
> In the second case, dimnames(aa) is not a list (like in the first case)
> but it works.
> I would expect that the both work or neither.
I agree (even though I'm strongly advising people to use '<-'
instead of '=');
which in this case helps you get the name of the function really
involved: It is `dimnames<-` (which is implemented in C
entirely, for matrices and other arrays).
> Your thoughts are welcome.
I think we'd be happy if you report this formally on R's
bugzilla - https://bugs.r-project.org/ - as a bug.
>From reading bugs.html you note that you should ask for an account there;
as I'm one of the people who get such request by e-mail, in this
case, I can do it directly (if you confirm you'd want in a
> PS the same apply for dimnames(a)[]<-.
NB *and* importantly, the buglet is still in current versions of R
> R version 3.6.1 (2019-07-05)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Mageia 7
> Matrix products: default
> BLAS/LAPACK: /home/opt/OpenBLAS/lib/libopenblas_sandybridge-r0.3.6.so
>  LC_CTYPE=fr_FR.UTF-8 LC_NUMERIC=C
>  LC_TIME=fr_FR.UTF-8 LC_COLLATE=fr_FR.UTF-8
>  LC_MONETARY=fr_FR.UTF-8 LC_MESSAGES=fr_FR.UTF-8
>  LC_PAPER=fr_FR.UTF-8 LC_NAME=C
>  LC_ADDRESS=C LC_TELEPHONE=C
>  LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C
> attached base packages:
>  parallel stats graphics grDevices utils datasets methods
>  base
> other attached packages:
>  multbxxc_1.0.1 rmumps_5.2.1-11
>  arrApply_2.1 RcppArmadillo_0.9.800.4.0
>  Rcpp_1.0.3 slam_0.1-47
>  nnls_1.4
> loaded via a namespace (and not attached):
>  compiler_3.6.1 tools_3.6.1 codetools_0.2-16
> R-devel using r-project.org mailing list
More information about the R-devel