On Mon, 18 Oct 2004, Robin Hankin wrote:

> How do I concatenate two lists element-by-element?

> Example:
> 
> list.1 <- list(temperature=c("hot","cold") , size=c("big","medium"))
> list.2 <- list(temperature=c("lukewarm")   , size=c("massive","tiny"))
> 
> 
> list.wanted  <- list(temperature=c("hot","cold","lukewarm") ,
>                        size=c("big","medium","massive","tiny"))
> 
> 
> 
> (the lists are dimnames() of an array).

mapply(c, list.1, list.2)

(but it loses the list names, so copy them across).

-- 
Brian D. Ripley,                  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to