[R] Matrix::bdiag doesn't like being given a single named argument

Benjamin Tyner btyner @end|ng |rom gm@||@com
Fri May 31 15:25:19 CEST 2019


Hello,

Perhaps not a bug, but interesting because the error only happens when 
there is a single named argument.

    > m <- matrix(1, 1, 1)
    > library(Matrix)
    > bdiag(m)
    1 x 1 sparse Matrix of class "dgCMatrix"

    [1,] 1
    > bdiag(a = m)
    Error in is.list(...) : supplied argument name 'a' does not match 'x'
    > bdiag(a = m, b = m)
    2 x 2 sparse Matrix of class "dgCMatrix"

    [1,] 1 .
    [2,] . 1

Moreover, this works fine:

    > bdiag(list(a = m))
    1 x 1 sparse Matrix of class "dgCMatrix"

    [1,] 1

Thoughts?

Regards

Ben



More information about the R-help mailing list