[R] manipulating elements of lists

From: Christoph Heibl <christoph.heibl_at_gmx.net>
Date: Tue 09 Jan 2007 - 15:26:18 GMT


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: heibl@lmu.de



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. Received on Wed Jan 10 14:42:38 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 10 Jan 2007 - 10:30:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.