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
  •  | 
  •  

Frage

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?

War es hilfreich?

Lösung

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

Andere Tipps

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top