Re: [R] column to row

From: Paul Smith <phhs80_at_gmail.com>
Date: Mon 14 Aug 2006 - 21:52:59 EST

On 8/14/06, yohannes alazar <hannesalazar@gmail.com> wrote:
> I have a data in two columns and how can i convert it to one row . thank you
> in advance
>
> inpute
>
> 1 2
> 3 4
> 5 6
> 7 8
> 9 1
>
>
> out put
>
> 1 2 3 4 5 6 7 8 9 1

An example follows:

> input <- matrix(1:10,5,2)
> input

     [,1] [,2]

[1,]    1    6
[2,]    2    7
[3,]    3    8
[4,]    4    9
[5,]    5   10

> output <- c(input[,1],input[,2])
> output

 [1] 1 2 3 4 5 6 7 8 9 10
>

Paul



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 Mon Aug 14 21:55:50 2006

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 Tue 15 Aug 2006 - 00:23:26 EST.

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