I would like to get better dimensions of R data structures, especially tensors and list of lists.
I think I have now a tensor or four lists of lists passed to my function i.e. four matrices, which causes the bug, which I did not notice because str(Matrix)
says only List of 4
, better would be dimensions etc 4x1505x1505
.
Also print(dim(Matrix))
returns NULL
because it is designed for matrix/array/data frame.
I have the following inside a function
print("Just before the matrix")
print(dim(Matrix))
str(Matrix)
print("Just before turning the matrix")
Matrix <- apply(Matrix, 2, rev) # http://stackoverflow.com/a/9135850/54964
Output
[1] "Just before the matrix"
NULL
List of 4
$ : num [1:1505, 1:1505] 1 -0.2936 -0.0394 -0.1898 0.4661 ...
$ : num [1:1505, 1:1505] 1 -0.4002 0.3807 -0.0657 -0.2308 ...
$ : num [1:1505, 1:1505] 1 0.63871 -0.03072 -0.11423 -0.00918 ...
$ : num [1:1505, 1:1505] 1 0.1347 -0.0531 -0.0836 -0.0101 ...
[1] "Just before turning the matrix"
Error in apply(Matrix, 2, rev) : dim(X) must have a positive length
Calls: makeMatrixPlot -> apply
Execution halted
Proposal: get dimensions of the data structure than descriptive words
R: 3.3.1
OS: Debian 8.5