How do I manipulate/access elements of an instance of “dist” class using core R?

前端 未结 12 1948
傲寒
傲寒 2021-02-02 10:50

A basic/common class in R is called \"dist\", and is a relatively efficient representation of a symmetric distance matrix. Unlike a \"matrix\" object,

12条回答
  •  遥遥无期
    2021-02-02 11:08

    Seems dist objects are treated pretty much the same way as simple vector objects. As far as I can see its a vector with attributes. So to get the values out:

    x = as.vector(distobject)
    

    See? dist for a formula to extract the distance between a specific pair of objects using their indices.

提交回复
热议问题