r - Distance matrix to dist element -
New to R here. I have calculated a distance matrix, say, points a, b, c:
(a, a) = 0; (A, B) = 1; (A, C) = 5; (B, A) = 1; (B, B) = 0; (B, C) = 7; (C, A) = 5; (C, B) = 7; (C, C) = 0; And I want to use a function that expects the 'distribution' element RA is the result of a calculation on the coordinates of the working item, but this is not a standard calculation , So I can not make a distinction using distant constructor, which expects only several predefined distance measures.
The bottom line is that I want to make the element of the district out of that matrix which I have calculated.
Appreciate your help!
You can create a square object from a matrix
simply create the matrix and Use as.dist example
as.dist (matrix (c (0, 1, 5, 1, 0, 7 , 5, 7, 0), ncol = 3)) 1 2 2 1 3 5 7
Comments
Post a Comment