HenrikBengtsson / listenv

R package: listenv - Environments Behaving As Lists
https://listenv.futureverse.org
30 stars 2 forks source link

Dimensions: unlist(x) when x has dimensions looses names attribute #23

Closed HenrikBengtsson closed 8 years ago

HenrikBengtsson commented 8 years ago

Call unlist(x) on a list environment x with dimensions looses the names attribute, e.g.

> x <- as.listenv(1:6)
> dim(x) <- c(2,3)
> names(x) <- letters[1:6]
> x
`listenv` with 6 (2x3) elements: 'a', 'b', 'c', 'd', 'e', 'f'.
> unlist(x)
[1] 1 2 3 4 5 6

However, if we remove dimensions first, then the names are there:

> x <- undim(x)
> unlist(x)
a b c d e f
1 2 3 4 5 6