[Rd] ambiguity in the documented return value of Null() from package MASS

peter dalgaard pdalgd at gmail.com
Mon Nov 10 14:47:16 CET 2014


There is a maintainer for this contributed package...

However, a zero column vector _is_ numeric(0) -- with dimension attributes c(3,0). 

structure(numeric(0),dim=c(3,0))
c(Null(diag(3)))

I.e., the ambiguity is pretty slight. 

Presumably, the help file wording goes back to S-PLUS which (to my recollection) didn't allow zero-extent matrices. The actual behaviour is a clear improvement.

- Peter D.



On 10 Nov 2014, at 13:49 , Georgi Boshnakov <georgi.boshnakov at manchester.ac.uk> wrote:

> Hi,
> 
> Function Null from package MASS seems to return a matrix with zero columns and the expected number of rows when
> the null space of the argument contains only the zero vector, e.g. 
> 
>> library(MASS)
>> diag(nrow=3)
>     [,1] [,2] [,3]
> [1,]    1    0    0
> [2,]    0    1    0
> [3,]    0    0    1
> 
>> Null(diag(nrow=3))
> 
> [1,]
> [2,]
> [3,]
> 
> But the documentation of Null  seems to imply that the result is numeric(0):
> 
> -----------------------------------------------
> 
> Value: 
> 
> The matrix 'N' with the basis for the null space, or an empty
>     vector if the matrix 'M' is square and of maximal rank.
> 
> -----------------------------------------------
> 
> (R version 3.1.1 Patched (2014-09-21 r66653) -- "Sock it to Me")
> 
> Georgi
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-devel mailing list