What is the package to be installed in R version 2.15.2 to compute euclidean distance? [duplicate]

StackOverflow https://stackoverflow.com/questions/20749626

  •  21-09-2022
  •  | 
  •  

문제

I want to find out the euclidean distance of two matrices using the rdist() function. It requires the fields package to be imported first. I am using R version 2.15.2 and unable to install this package as its giving error that package ‘fields’ is not available (for R version 2.15.2). Which package should I install?

도움이 되었습니까?

해결책

If you really don't want to use rdist you could use dist this is in stats and so part of base

dist(x, method = "euclidean")

e.g.

dist(rbind( c(1,2,3), c(3,2,1) ), method = "euclidean")
# this is the distance of the two vectors

다른 팁

You need to downlaod R version 3.0(or higher) and fields package also has dependencies - You also need to install spam and maps,

Depends: R (≥ 3.0), methods, spam, maps

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top