Hi Alex,
Not sure if this is what you wanted.
length(res) #from the previous 'example' using ##indx <-
combn(dim(results)[1],2)
#[1] 45
mat1 <- matrix(0,10,10)
mat1[lower.tri(mat1)] <- res
mat1[upper.tri(mat1)] <- res
A.K.
On Saturday, January 11, 2014 12:22 AM, alex padron
wro
It seems like emdist does not like to compare matrices with all 0 values. I
ended up removing those from my 3D array and have ~8000 matrices instead of
13000.
I am using res2 <- unlist(mclapply(seq_len(ncol(indx)),function(i) {x1 <-
indx[,i]; emd2d(results[x1[1],,],results[x1[2],,]) }) )
But even
Hi,
No problem.
You can use ?lower.tri() or ?upper.tri()
res[lower.tri(res)]
res[lower.tri(res,diag=TRUE)]
#Other way would be to use:
?combn
indx <- combn(dim(results)[1],m=2)
res2 <- sapply(seq_len(ncol(indx)),function(i) {x1 <- indx[,i];
emd2d(results[x1[1],,],results[x1[2],,]) })
identical
Hi,
Try:
library(emdist)
set.seed(435)
results<- array(sample(1:400,120,replace=TRUE),dim=c(10,3,4))
res <- sapply(seq(dim(results)[1]),function(i) {x1 <- results[i,,]; x2 <-
results; sapply(seq(dim(x2)[1]),function(i) emd2d(x1,x2[i,,]))})
dim(res)
#[1] 10 10
A.K.
On Thursday, January 9, 2
4 matches
Mail list logo