Re: [R] looping function through list

2014-01-02 Thread arun
HI, I tested it on R 3.0.2 console (linux) and also on Rstudio Version 0.98.490.  It seems alright. A.K.  Thanks for this. I am trying to run the code you posted but Rstudio keeps crashing. I am trying to run it on the example output1 since it's small but that crashes as well. On Thursday

Re: [R] looping function through list

2014-01-02 Thread arun
#or  mapply(emd2d,sapply(output1,`[`,1),sapply(output1,`[`,2)) #[1]   NaN -6.089909 A.K. On Thursday, January 2, 2014 2:33 PM, arun wrote: Hi, May be this helps:  set.seed(42)  output1 <- list(list(matrix(0,8,11),matrix(0,8,11)), list(matrix(rnorm(80),8,10),matrix(rnorm(80),8,10)))  libra

Re: [R] looping function through list

2014-01-02 Thread arun
Hi, May be this helps:  set.seed(42)  output1 <- list(list(matrix(0,8,11),matrix(0,8,11)), list(matrix(rnorm(80),8,10),matrix(rnorm(80),8,10)))  library(emdist)  sapply(output1,function(x) {emd2d(x[[seq_along(x)[1]]],x[[seq_along(x)[2]]]) }) #[1]   NaN -6.089909 A.K. I'm trying to apply a fu