Skip to content

mbind dimnames[3] NULL #201

Description

@pascal-sauer
> a <- new.magpie(1:10)
> mbind(a, a)
A magpie object (package: magclass)
 @ .Data:  logi [1:20] NA NA NA NA NA NA ...
 $ dimnames:List of 3
  ..$ region.region1: chr [1:10] "GLO.1" "GLO.2" "GLO.3" "GLO.4" ...
  ..$ year          : NULL
  ..$ data          : NULL
> dim(mbind(a, a))
[1] 10  1  2
> length(dimnames(mbind(a, a))[3])
[1] 1

Having dim[3] be 2 here is weird if dimnames are still just NULL, and the length of dimnames is 1. In contrast, if there is a name set it looks like this:

> a <-  setNames(new.magpie(1:10), "a")
> mbind(a, a)
A magpie object (package: magclass)
 @ .Data:  logi [1:20] NA NA NA NA NA NA ...
 $ dimnames:List of 3
  ..$ region.region1: chr [1:10] "GLO.1" "GLO.2" "GLO.3" "GLO.4" ...
  ..$ year          : NULL
  ..$ data          : chr [1:2] "a" "a"

I think we should align how the two cases work. How to best do this though? Do we want dimnames[3] to be c("NULL", "NULL") or c("dummy", "dummy") or something else? What do you think @codeZeilen @tscheypidi ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions