1

How can I use hclust() in R when the dataset I am using has NA values? This is the function I have set up:

data2 = apply(data,2, as.numeric)
data2.hclust = hclust(data2, method='median')

When I attempt this I receive this error message:

Error in if (is.na(n) || n > 65536L) stop("size cannot be NA nor exceed 65536") : 
missing value where TRUE/FALSE needed

Is there anyway to use the hclust() function even with NA values?

rcs
  • 67,191
  • 22
  • 172
  • 153
bubbalouie
  • 643
  • 3
  • 10
  • 18
  • 4
    You don't call `hclust` directly on your data, you call it on a `dist` object, ie. `hclust(dist(data2))`. – rmccloskey Nov 29 '14 at 02:21
  • Also check this link http://stackoverflow.com/questions/20343398/how-to-use-hclust-as-function-call-in-r – akrun Nov 29 '14 at 04:10

0 Answers0