On 20-Aug-07 09:49:08, jenny wrote:> Hi, how do I interweave 2 columns of data into a single column? See
> illustration below. Thx-jenny I have 2 columns of data Col1 Col21
> 2 3 45 6 7 89 10 I want to
> create
> a new column with interlocking cell centries12345678910 Get the new
> Windows Live Messenger! Try it!
> _________________________________________________________________
> Did you know you can import your contact list from Microsoft? Office? O
>
> [[alternative HTML version deleted]]
Re-structuring your exmaple as received [please see to your mailer's
formating!] into what I think you may mean:
Col1 Col2
1 2
3 4
5 6
7 8
9 10
You haven't stated in what form these two columns are available to
you at the point where you want to "merge" them, so I'll give two
answers (there may be others, deending on the source of Col1 and
Col2).
1. Suppose they are two columns of a matrix M:
M
c1 c2
[1,] 1 2
[2,] 3 4
[3,] 5 6
[4,] 7 8
[5,] 9 10
Then:
as.vector(t(M))
[1] 1 2 3 4 5 6 7 8 9 10
2. Suppose they are available as separate vectors Col1 and Col2:
as.vector(rbind(Col1,Col2))
[1] 1 2 3 4 5 6 7 8 9 10
Best wishes,
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 20-Aug-07 Time: 12:27:54
------------------------------ XFMail ------------------------------