Returns the tensor as (flat) ftable, providing a pretty output.

# S3 method for class 'tensor'
ftable(x,...)

Arguments

x

the tensor

...

additional arguments to ftable

Value

an ftable containing the same data as the tensor

Details

This function is called for a pretty output of a tensor, just try it.

See also

Author

K. Gerald van den Boogaart

Examples

A <- to.tensor(1:20,c(U=2,V=2,W=5))
A
#> , , 1
#> 
#>       V
#> U      [,1] [,2]
#>   [1,]    1    3
#>   [2,]    2    4
#> 
#> , , 2
#> 
#>       V
#> U      [,1] [,2]
#>   [1,]    5    7
#>   [2,]    6    8
#> 
#> , , 3
#> 
#>       V
#> U      [,1] [,2]
#>   [1,]    9   11
#>   [2,]   10   12
#> 
#> , , 4
#> 
#>       V
#> U      [,1] [,2]
#>   [1,]   13   15
#>   [2,]   14   16
#> 
#> , , 5
#> 
#>       V
#> U      [,1] [,2]
#>   [1,]   17   19
#>   [2,]   18   20
#> 
#> attr(,"class")
#> [1] "tensor"
dim(A)
#> U V W 
#> 2 2 5 
names(A)
#> [1] "U" "V" "W"
dimnames(A)
#> $U
#> NULL
#> 
#> $V
#> NULL
#> 
#> $W
#> NULL
#> 

ftable(to.tensor(A))
#>       W W1 W2 W3 W4 W5
#> U  V                  
#> U1 V1    1  5  9 13 17
#>    V2    3  7 11 15 19
#> U2 V1    2  6 10 14 18
#>    V2    4  8 12 16 20
ftable(to.tensor(c(A),dim(A)))
#>       W W1 W2 W3 W4 W5
#> U  V                  
#> U1 V1    1  5  9 13 17
#>    V2    3  7 11 15 19
#> U2 V1    2  6 10 14 18
#>    V2    4  8 12 16 20