Re: [R] Merging data in arrays

2013-02-23 Thread Jeff Newmiller
There is a reason why merge is not designed to work directly with arrays: the matching of rows can easily yield a result with a different number of rows than the initial data had. This plays havoc with the nature of arrays. I would recommend that if a merge is really what you want then unrolling

Re: [R] Merging data in arrays

2013-02-22 Thread Rui Barradas
Hello, I bet there are simpler solutions but I'm not thinking of anything else, right now. fun <- function(x, y){ f <- function(a, b){ a <- as.data.frame(a) b <- as.data.frame(b) names(a)[1] <- names(b)[1] <- "V1" res <- m

Re: [R] Merging data in arrays

2013-02-21 Thread Ray Cheung
Thanks, Jeff. Here is a simplified hypothetical sample (sorry for the clumsy code): A1 <- matrix(1:5, nrow=5, ncol=1) A2 <- matrix(6:10, nrow=5, ncol=1) A3 <- matrix(11:15, nrow=5, ncol=1) A4 <- matrix(16:20, nrow=5, ncol=1) A5 <- matrix(21:25, nrow=5, ncol=1) A6 <- matrix(26:30, nrow=5, ncol=1) B

Re: [R] Merging data in arrays

2013-02-21 Thread Jeff Newmiller
I think this specification is insufficient to respond accurately to. Please make a reproducible subset of your data (or simulated data) and provide it in dput form, and describe your desired result data set more clearly. http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducib

Re: [R] Merging data in arrays

2013-02-21 Thread Ray Cheung
Dear All, I've 2 arrays A and B: dim(A) = 100, 10, 1000 dim(B) = 100, 20, 900 I know there are 5 columns of values common to both arrays. I want to ask how to merge the 2 arrays. Thanks in advance! Best Regards, Ray [[alternative HTML version deleted]]

Re: [R] Merging data in arrays

2013-02-07 Thread Ray Cheung
matrix(!x[,-1]%in% x[,1],nrow=5),2,all))]) > Fnew<-array(unlist(list1),dim=c(dim(list1[[1]]),length(list1))) > > identical(F,Fnew) > #[1] TRUE > A.K. > > > - Original Message - > From: Ray Cheung > To: r-help@r-project.org > Cc: > Sent: Wednesday, Feb

Re: [R] Merging data in arrays

2013-02-07 Thread arun
im(list1[[1]]),length(list1)))  identical(F,Fnew) #[1] TRUE A.K. - Original Message - From: Ray Cheung To: r-help@r-project.org Cc: Sent: Wednesday, February 6, 2013 10:16 PM Subject: [R] Merging data in arrays Dear All, Here is a hypothetical sample (sorry for the clumsy code): A1 &l

[R] Merging data in arrays

2013-02-06 Thread Ray Cheung
Dear All, Here is a hypothetical sample (sorry for the clumsy code): A1 <- matrix(1:5, nrow=5, ncol=1) A2 <- matrix(6:10, nrow=5, ncol=1) A3 <- matrix(11:15, nrow=5, ncol=1) A4 <- matrix(16:20, nrow=5, ncol=1) A5 <- matrix(21:25, nrow=5, ncol=1) A6 <- matrix(26:30, nrow=5, ncol=1) B1 <- matrix(c