Dear all,
I would like to know if there is a function to concatenate two lists
while replacing elements with the same name.

For example:

x <- list(a=1,b=2,c=3)
y <- list( b=4, d=5)
z <- list(a = 6, b = 8, e= 7)

I am looking for a function "concatfun" so that

u <- concatfun(x,y,z)

returns:

u$a=6
u$b=8
u$c=3
u$d=5
u$e=7

I.e. it combines the 3 lists, but when names have the same value it
keeps the most recent one.

Does such a function exists?

Thanks for the help,

Cheers,
Luca

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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