-2

Does anyone familiar with the Iris data set? Please correct me if I am wrong, but this data set has 4 dimensions. However, ndims returns only 2. How is that possible?

Eitan T
  • 32,660
  • 14
  • 72
  • 109
dee
  • 1
  • 1

1 Answers1

2

It has 2 dimensions, one of length 150 and the other of length 4 (not including Species data). Perhaps you want to use size instead of ndims?

James
  • 65,548
  • 14
  • 155
  • 193
  • size will return 150 4. which corresponds to your answer above. I just still do not understand why does dimension equal to 2? I have tried searching for the meaning of the dimensions. It does tell me that, dimension is quite similar with an array. – dee May 27 '13 at 18:42
  • @dee You can add an additional parameter to your `size` call to get just the number of columns, ie `size(iris,2)`. `ndims` gives the number of dimensions of the array, ie the dimensionality of the "hypercube" it can conceptualised as. This is obviously pretty meaningless for a flat database, as the answer will always be 2. – James May 28 '13 at 09:37