A dimension of length 1 is added a given position to a tensor
undrop.tensor(A,name,pos=1)
Arguments
- A
the tensor
- name
the name of the dimension to be added
- pos
the position, where to insert the new dimension
Value
A tensor with one extra dimension of length 1 with name name at
position pos.
Details
The function is a pure convenience function.
Author
K. Gerald van den Boogaart
Examples
A <- to.tensor(1:4,c(a=2,b=2))
undrop.tensor(A,"i")
#> , , 1
#>
#> b
#> a [,1] [,2]
#> [1,] 1 3
#> [2,] 2 4
#>
#> attr(,"class")
#> [1] "tensor" "matrix"