HenrikBengtsson / listenv

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

Dimensions: Add diag(x)? #29

Closed HenrikBengtsson closed 3 years ago

HenrikBengtsson commented 8 years ago

Should we add diag() for list environments?

(Moved from Issue #22)

HenrikBengtsson commented 3 years ago

diag() is not a generic function, so it won't work as-is. The second best would be to create something like:

diag2 <- function(x) {
  x[diag(seq_along(x), nrow = nrow(x)) > 0]
}