This is great but when I try your.data[distances<3,]
I get the error:
Error in your.data[distances < 3, ] :
'list' object cannot be coerced to type 'double'
I've tried doing this first:
distances <- as.numeric(unlist(distances))
This seems to do the trick, does that seem valid to you?
Thanks very much
Most probably not an exact answer but you can look at Andreas Wagners paper (here https://www.genetics.org/content/176/4/2451 ) The perl script to find clusters of SNPs is available here https://www.ieu.uzh.ch/wagner/publications-software.html