You don't make it clear if you want the two lists processed in parallel, but if so, this may be a step toward the function you want:
Combine <- function(l1, l2) { pattern <- cbind(c(1, 2, 2, 3), c(1, 1, 2, 2)) for (i in 1:length(l1)) { print((l1[[i]][,pattern[,1]]+l2[[i]][,pattern[,2]])/2) } } Combine(l1, l2) This simply prints the results, but you didn't indicate how you wanted the output organized. ---------------------------------------------- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -----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 components > in a list > > 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 > <hans.thomps...@gmail.com> wrote: > > 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 > lists > > at the same time. > > > > -- > > View this message in context: http://r.789695.n4.nabble.com/applying- > cbind-or-any-function-across-all-components-in-a-list- > tp4631128p4631187.html > > Sent from the R help mailing list archive at Nabble.com. > > > > ______________________________________________ > > R-help@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > -- > Gregory (Greg) L. Snow Ph.D. > 538...@gmail.com > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.