Learn R Programming

tensorA (version 0.36.2.1)

untensor: Removes indices/dimensions from a tensor

Description

untensor is more or less the inverse of to.tensor. It flattens tensorial dimensions. However the result is still a tensor.

Usage

untensor(X,i=NULL,name=NULL,pos=1,by=NULL)

Value

a tensor with the dimensions i removed.

Arguments

X

the tensor

i

the names of the dimensions to be removed and combined to a single new one as a character vector or a named list of character vectors if the remove should be done in multiple chunks. pos and name is in this case ignored.

name

the name of the new dimension to replace the others

pos

where to insert the the new dimension

by

if i not given the dimensions to be kept

Author

K.Gerald van den Boogaart

Details

The dimensions to be removed are gathered and

See Also

to.tensor

Examples

Run this code
A <- to.tensor(1:64,c(a=2,b=2,c=2,d=2,e=2,f=2))
untensor(A,list(c(1,5),c(2,4)),name=c("i","j"))
untensor(A,by=c("c","f"))
untensor(A,c("a","d"))

Run the code above in your browser using DataLab