1

I am trying to calculate the distances between pairs using distances function in r language and I have selected HVDM as the matric. My code looks like this:

library("UBL")
df <- read.table(file="C:/Users/Mahin/Workspace/Abalone/abalone.txt",header=T, sep=",")
dist1 <- distances("rings", df, "HVDM")
print(dist1)

I have also tried putting 9 in place of the target column as the rings column is at 9th position. Something like this:

dist1 <- distances(9, df, "HVDM")

Nonetheless, nothing works. Could anyone please point out the mistake that I have made?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Mahin
  • 449
  • 2
  • 14
  • 25
  • What is the error that you get? – Vishesh Shrivastav Aug 15 '18 at 16:31
  • It doesn't finish. @VisheshShrivastav – Mahin Aug 15 '18 at 16:32
  • Can you be a bit more specific please? What doesn't finish? What error/warning do you see? – Vishesh Shrivastav Aug 15 '18 at 16:33
  • Actually, after running the script I have waited for an hour, but it didn't finish. So, I tried reducing the number of samples and I used only ten sample. However, the result was the same. It was just running – Mahin Aug 15 '18 at 16:39
  • 1
    Can you provide `dput(df)`? – acylam Aug 15 '18 at 16:54
  • structure(list(sex = structure(c(3L, 3L, 1L, 3L, 2L), .Label = c("F", "I", "M"), class = "factor"), length = c(0.455, 0.35, 0.53, 0.44, 0.33), diameter = c(0.365, 0.265, 0.42, 0.365, 0.255), height = c(0.095, 0.09, 0.135, 0.125, 0.08), whole_weight = c(0.514, 0.2255, 0.677, 0.516, 0.205), shucked_weight = c(0.2245, 0.0995, 0.2565, 0.2155, 0.0895), viscera_weight = c(0.101, 0.0485, 0.1415, 0.114, 0.0395 ), shell_weight = c(0.15, 0.07, 0.21, 0.155, 0.055), rings = c(15L, 7L, 9L, 10L, 7L)), row.names = c(NA, 5L), class = "data.frame") – Mahin Aug 15 '18 at 16:58
  • @VisheshShrivastav, I managed to do it for the reduced number of samples, but for all the sample it is not finishing. Is there any way of doing this in a more efficient manner? – Mahin Aug 15 '18 at 17:02

0 Answers0