R-helpers:

Say I have two lists of arbitrary elements, e.g.:

 list1=list(c(1:3),"R is fun!",c(3:6))

list2=list(c(10:5),c(5:3),c(13,5),"I am so confused")


I would like to produce a single new list that is composed of all
combinations of the "top level" of list1 and list2, e.g.:

listcombo=list(list(list1[[1]],list2[[1]]),list(list1[[1]],list2[[2]]
),...,list(list1[[length(list1)]],list2[[length(list2]]))

What is the most efficient way to do this?  Thanks!

--j

-- 
Jonathan A. Greenberg, PhD
Assistant Professor
Department of Geography
University of Illinois at Urbana-Champaign
607 South Mathews Avenue, MC 150
Urbana, IL 61801
Phone: 415-763-5476
AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307, Skype: jgrn3007
http://www.geog.illinois.edu/people/JonathanGreenberg.html

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to