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
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 <-
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
3 matches
Mail list logo