Output of dist() with more than 3 dimensional matrix in R -


i'm new r. can't figure out meaning of dist() out.

i understand following. because euclidean distance between (1,3) , (2,4) √2

> x = matrix(1:4, 2, 2)  > x      [,1] [,2] [1,]    1    3 [2,]    2    4  > dist(x)          1 2 1.414214 

but how should see output more 3 dimensional matrix?

> x=matrix(1:25, 5,5)  > x      [,1] [,2] [,3] [,4] [,5] [1,]    1    6   11   16   21 [2,]    2    7   12   17   22 [3,]    3    8   13   18   23 [4,]    4    9   14   19   24 [5,]    5   10   15   20   25  > dist(x)          1        2        3        4 2 2.236068 3 4.472136 2.236068 4 6.708204 4.472136 2.236068 5 8.944272 6.708204 4.472136 2.236068 

the number in cell in column named "1" , row named "2" distance between first , second rows of data.

so 2.236068 distance between vectors c(1,6,11,16,21) , c(2,7,12,17,22) (rows 1 , 2),
4.472136 distance between vectors c(1,6,11,16,21) , c(3,8,13,18,23) (rows 1 , 3) , on.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -