unfold | R Documentation |
Conducts matricizations of a three-way array into matrices according to the selected mode.
unfold(x, mode=c("A", "B", "C"))
x |
Array to be unfolded |
mode |
the selected mode for unfolding |
A matrix represnting the input array, according to the selected mode:
Mode=A: B
-mode entities are nested within C
-mode entities (all the frontal slices of the array next to each other)
item Mode=B: C
-mode entities nested within A
-mode entities (all the horizontal slices of the array next to each other)
item Mode C: A
-mode entities nested within B
-mode entities (all the lateral slices of the array next to each other)
Valentin Todorov valentin.todorov@chello.at
H.A.L. Kiers (2000). Towards a standardized notation and terminology in multiway analysis. Journal of Chemometrics 14:105–122.
(X <- array(1:24, c(4,3,2)))
dim(X)
## matricize the array
## matricized X with the A-mode entities in its rows
## all the frontal slices of the array next to each other
##
(Xa <- unfold(X))
dim(Xa)
## matricized X with the B-mode entities in its rows
## all the horizontal slices of the array next to each other
##
(Xb <- unfold(X, mode="B"))
dim(Xb)
## matricized X with the C-mode entities in its rows
## all the lateral slices of the array next to each other
##
(Xc <- unfold(X, mode="C"))
dim(Xc)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.