Maybe I misunderstand what you want to do, one solution is: > l1 $a [1] 1 2
$b [1] 1 2 3 $c [1] 1 2 3 4 > l2 V1 V2 1 d nd 2 c nc 3 b nb 4 a na > names(l1)<-sapply(names(l1),function(n)l2[l2$V1==n,2]) > l1 $na [1] 1 2 $nb [1] 1 2 3 $nc [1] 1 2 3 4 On 1/10/07, Christoph Heibl <[EMAIL PROTECTED]> wrote: > I want to manipulate lists as described below: > Imagine these two lists: > > > list1 > $WR7 > [1] 1 2 3 4 > > $YH5YH6 > [1] 3 4 5 6 7 > > $YH4 > [1] 4 5 > > $UC4UC8 > [1] 4 5 6 7 8 9 > > > list2 > V1 V2 > 1 WR7 Averrhoa > 2 ? Sarcotheca > 3 YH5YH6 caesia > 4 YH4 arbuscula > 5 UC4UC8 rosea > 6 ? acetosella > > How can I exchange the names(list1) by the entries in the second > column of list2, > if (a) length(list1) ≠ length(list2) and (b) the elements of both > lists are not in the same order? Is there a easy way to do this? > > Thank you! > > > > > ________________________________________________________ > > Christoph Heibl > > PhD student > > 'Phylogenetics and phylogeography of endemic Atacama Desert flora' > > Systematic Botany > Ludwig-Maximilians-Universität München > Menzinger Str. 67 > D-80638 München > GERMANY > > phone: +49-(0)89-17861-251 > e-mail: [EMAIL PROTECTED] > > > ______________________________________________ R-help@stat.math.ethz.ch 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.