Dear list, I do not know what would be the 'correct' answer to the following but I think that they should return the same value to avoid potential problems and hard to debug errors. Regards, Simone ---------------------------------------> NCOL(NULL)[1] 1> NROW(NULL)[1] 0> sessionInfo()R version 4.3.1 RC (2023-06-08 r84523 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 11 x64 (build 22621) Matrix products: default locale: [1] LC_COLLATE=Italian_Italy.utf8 LC_CTYPE=Italian_Italy.utf8 [3] LC_MONETARY=Italian_Italy.utf8 LC_NUMERIC=C [5] LC_TIME=Italian_Italy.utf8 time zone: Europe/Rome tzcode source: internal attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] compiler_4.3.1 -- ___________________________________________________ Simone Giannerini Dipartimento di Scienze Statistiche "Paolo Fortunati" Universita' di Bologna Via delle belle arti 41 - 40126 Bologna, ITALY Tel: +39 051 2098262 Fax: +39 051 232153 https://simonegiannerini.net/
It's been documented for a long time that NCOL(NULL) is 1. What particular problems did you have in mind? There might be other ways to guard against them. Duncan Murdoch On 23/09/2023 1:43 p.m., Simone Giannerini wrote:> Dear list, > > I do not know what would be the 'correct' answer to the following but > I think that they should return the same value to avoid potential > problems and hard to debug errors. > > Regards, > > Simone > --------------------------------------- > >> NCOL(NULL) > [1] 1 > >> NROW(NULL) > [1] 0 > >> sessionInfo() > R version 4.3.1 RC (2023-06-08 r84523 ucrt) > Platform: x86_64-w64-mingw32/x64 (64-bit) > Running under: Windows 11 x64 (build 22621) > > Matrix products: default > > > locale: > [1] LC_COLLATE=Italian_Italy.utf8 LC_CTYPE=Italian_Italy.utf8 > [3] LC_MONETARY=Italian_Italy.utf8 LC_NUMERIC=C > [5] LC_TIME=Italian_Italy.utf8 > > time zone: Europe/Rome > tzcode source: internal > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > loaded via a namespace (and not attached): > [1] compiler_4.3.1 >
I just saw this ------------------------------------------------------------------------ r85704 | hornik | 2023-12-19 00:33:07 -0600 (Tue, 19 Dec 2023) | 1 line Changed paths: M /trunk/doc/NEWS.Rd M /trunk/src/library/base/R/matrix.R M /trunk/src/library/base/man/nrow.Rd M /trunk/src/library/profile/Common.R Have NCOL(NULL) return 0 instead of 1. ------------------------------------------------------------------------ Many thanks to Kurt and the whole R-core team! Simone On Sat, Sep 23, 2023 at 7:43?PM Simone Giannerini <sgiannerini at gmail.com> wrote:> > Dear list, > > I do not know what would be the 'correct' answer to the following but > I think that they should return the same value to avoid potential > problems and hard to debug errors. > > Regards, > > Simone > --------------------------------------- > > > NCOL(NULL) > [1] 1 > > > NROW(NULL) > [1] 0 > > > sessionInfo() > R version 4.3.1 RC (2023-06-08 r84523 ucrt) > Platform: x86_64-w64-mingw32/x64 (64-bit) > Running under: Windows 11 x64 (build 22621) > > Matrix products: default > > > locale: > [1] LC_COLLATE=Italian_Italy.utf8 LC_CTYPE=Italian_Italy.utf8 > [3] LC_MONETARY=Italian_Italy.utf8 LC_NUMERIC=C > [5] LC_TIME=Italian_Italy.utf8 > > time zone: Europe/Rome > tzcode source: internal > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > loaded via a namespace (and not attached): > [1] compiler_4.3.1 > > -- > ___________________________________________________ > > Simone Giannerini > Dipartimento di Scienze Statistiche "Paolo Fortunati" > Universita' di Bologna > Via delle belle arti 41 - 40126 Bologna, ITALY > Tel: +39 051 2098262 Fax: +39 051 232153 > https://simonegiannerini.net/ > ___________________________________________________-- ___________________________________________________ Simone Giannerini Dipartimento di Scienze Statistiche "Paolo Fortunati" Universita' di Bologna Via delle belle arti 41 - 40126 Bologna, ITALY Tel: +39 051 2098262 Fax: +39 051 232153 https://simonegiannerini.net/
Reasonably Related Threads
- parRapply and parCapply return a list in corner cases
- Under Windows, Rgui and Rterm crash if one tries to close the graphic device while identify or locator are running
- Under Windows, Rgui and Rterm crash if one tries to close the graphic device while identify or locator are running
- bug in plot.ts?
- quantile(), IQR() and median() for factors