s-news
[Top] [All Lists]

Re: Concatenating random number of random length vectors

To: "P.J.Wells" <P.J.Wells@open.ac.uk>
Subject: Re: Concatenating random number of random length vectors
From: ripley@stats.ox.ac.uk
Date: Thu, 27 Mar 2003 16:56:03 +0000 (GMT)
Cc: "S-plus list (S-plus list)" <s-news@wubios.wustl.edu>
In-reply-to: <2AF05AF70A86A6438445BC3AC057F498204E28@mir.open.ac.uk>
On Thu, 27 Mar 2003, P.J.Wells wrote:

> The following looks like it should be simple, but I can't see it -- would
> someone kick-start me?
> 
> I have vectors sample.1, sample.2,...sample.N, where N is a random number,
> and length(sample.i) is also random.
> 
> How do I turn these into one big vector? 


do.call("c", list.of.vectors)

looks the simplest way.

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
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


<Prev in Thread] Current Thread [Next in Thread>