Re: [R] applying cbind (or any function) across all components in a list

2012-05-25 Thread Rui Barradas
l1)), function(i) fun2(l1[[i]], l2[[i]])) If I'm wrong, sorry for the mess. Rui Barradas Em 25-05-2012 11:00, r-help-requ...@r-project.org escreveu: Date: Thu, 24 May 2012 15:37:51 -0700 (PDT) From: Hans Thompson To:r-help@r-project.org Subject: Re: [R] applying cbind (or any function) a

Re: [R] applying cbind (or any function) across all components in a list

2012-05-25 Thread Hans Thompson
wrong, sorry for the mess. > > Rui Barradas > > > Em 25-05-2012 11:00, r-help-requ...@r-project.org escreveu: > >> Date: Thu, 24 May 2012 15:37:51 -0700 (PDT) >> From: Hans Thompson >> > >> >> To:r-help@r-project.org >> Subject: Re: [R] applyi

Re: [R] applying cbind (or any function) across all components in a list

2012-05-25 Thread Rui Barradas
s } lapply(seq_len(length(l1)), function(i) fun1(l1[[i]], l2[[i]])) lapply(seq_len(length(l1)), function(i) fun2(l1[[i]], l2[[i]])) If I'm wrong, sorry for the mess. Rui Barradas Em 25-05-2012 11:00, r-help-requ...@r-project.org escreveu: Date: Thu, 24 May 2012 15:37:51 -0700 (PDT) From:

Re: [R] applying cbind (or any function) across all components in a list

2012-05-25 Thread David L Carlson
oject.org > Subject: Re: [R] applying cbind (or any function) across all components > in a list > > Yes. This gives me: > > [,1] [,2] [,3] [,4] > [1,]1234 > [2,]2345 > [,1] [,2] [,3] [,4] > [1,]6789 > [2,]

Re: [R] applying cbind (or any function) across all components in a list

2012-05-24 Thread David Winsemius
On May 24, 2012, at 6:37 PM, Hans Thompson wrote: The function I am giving for context is cbind. Are you asking how I would like to apply the answer to my question? I am trying to take the results of a Fluidigm SNP microarray, organized by assay into a list (each component is the results

Re: [R] applying cbind (or any function) across all components in a list

2012-05-24 Thread Hans Thompson
The function I am giving for context is cbind. Are you asking how I would like to apply the answer to my question? I am trying to take the results of a Fluidigm SNP microarray, organized by assay into a list (each component is the results of one assay), find coordinate midpoints ([1,] and [2,] of

Re: [R] applying cbind (or any function) across all components in a list

2012-05-24 Thread Hans Thompson
Yes. This gives me: [,1] [,2] [,3] [,4] [1,]1234 [2,]2345 [,1] [,2] [,3] [,4] [1,]6789 [2,]789 10 BUT, how can I have it still within components like [[1]] [,1] [,2] [,3] [,4] [1,]1234 [2,]23

Re: [R] applying cbind (or any function) across all components in a list

2012-05-24 Thread David Winsemius
On May 24, 2012, at 12:49 PM, Hans Thompson wrote: I'm confused why I haven't made clear what I am asking for help with. I have two different lists with two (or many) components, [[1]] and [[2]]. One of the list has components with dim=c(2,3) and the other has dim=c(2,2). I want to create

Re: [R] applying cbind (or any function) across all components in a list

2012-05-24 Thread David L Carlson
; -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Greg Snow > Sent: Thursday, May 24, 2012 10:17 AM > To: Hans Thompson > Cc: r-help@r-project.org > Subject: Re: [R] applying cbind (or any function) across all

Re: [R] applying cbind (or any function) across all components in a list

2012-05-24 Thread Hans Thompson
I'm confused why I haven't made clear what I am asking for help with. I have two different lists with two (or many) components, [[1]] and [[2]]. One of the list has components with dim=c(2,3) and the other has dim=c(2,2). I want to create a new list with components dim=c(2,4) by binding togeth

Re: [R] applying cbind (or any function) across all components in a list

2012-05-24 Thread Greg Snow
The "do.call" function may be what you want, but it is not completely clear. If that does not solve your problem then try giving us an example of what your list looks like (the dput function can help) and what you want your end result to look like. On Thu, May 24, 2012 at 5:38 AM, Hans Thompson

Re: [R] applying cbind (or any function) across all components in a list

2012-05-24 Thread Hans Thompson
The combination of column means in cbind is what I am trying to do. I just don't know how to do it for every component (2 in this case) of the list. I've been able to work with R to apply a function across all components when there is just one list but I am having trouble working with multiple li

[R] applying cbind (or any function) across all components in a list

2012-05-23 Thread Hans Thompson
#If I have two lists as follows a1<- array(1:6, dim=c(2,3)) a2<- array(7:12, dim=c(2,3)) l1<- list(a1,a2) a3<- array(1:4, dim=c(2,2)) a4<- array(5:8, dim=c(2,2)) l2<- list(a3,a4) #how can I create a new list with the mean across all arrays within the list, so all components are included