View source: R/cast_dim2hier.R
| cast_dim2hier | R Documentation | 
cast_dim2hier() casts a dimensional list (i.e. an array of type list)
into a hierarchical/nested list. 
cast_dim2hier(x, ...)
## Default S3 method:
cast_dim2hier(x, in2out = TRUE, distr.names = FALSE, ...)
x | 
 an array of type   | 
... | 
 further arguments passed to or from methods.   | 
in2out | 
 see broadcast_casting.  | 
distr.names | 
 
  | 
A nested list. 
broadcast_casting 
x <- array(c(as.list(1:24), as.list(letters)), 4:2)
dimnames(x) <- list(
  letters[1:4],
  LETTERS[1:3],
  month.abb[1:2]
)
print(x)
# cast `x` from in to out, and distribute names:
x2 <- cast_dim2hier(x, distr.names = TRUE)
head(x2, n = 2)
# cast `x` from out to in, and distribute names:
x2 <- cast_dim2hier(x, in2out = FALSE, distr.names = TRUE)
head(x2, n = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.