powered by
ndims(x)
x
length(x)
A vector is seen as a matrix with one row, i.e. for a vector the number of dimensions is 2.
size
ndims(1:8) ndims(array(1:8, c(2,2,2)))
Run the code above in your browser using DataLab