Re: [R] How to Reshuffle a distance object

2009-04-16 Thread Gavin Simpson
Dale Steele wrote: I would like to randomly shuffle a distance object, such as the one created by ade4{dist.binary} below. My first attempt, using sample(jc.dist) creates a shuffled vector, losing the lower triangular structure of the distance object. How can I Ishuffle the lower triangular part

Re: [R] How to Reshuffle a distance object

2009-04-15 Thread Sarah Goslee
You don't say what your intent is, but for most applications it's important to preserve the pairwise matches. Here's one way to do that. library(ecodist) # for the convenient functions lower() and full() library(ade4) x1 <- c(rep(0,4),1) x2 <- c(rep(0,2),rep(1,3)) x3 <- c(rep(1,3), rep(0,2)) X <-

[R] How to Reshuffle a distance object

2009-04-15 Thread Dale Steele
I would like to randomly shuffle a distance object, such as the one created by ade4{dist.binary} below. My first attempt, using sample(jc.dist) creates a shuffled vector, losing the lower triangular structure of the distance object. How can I Ishuffle the lower triangular part of a distance matrix