Re: [R] column to row

2006-08-14 Thread Neuro LeSuperHéros
>input <- matrix(1:10,5,2)
>input
 [,1] [,2]
[1,]16
[2,]27
[3,]38
[4,]49
[5,]5   10
>as.vector(input)
[1]  1  2  3  4  5  6  7  8  9 10

Neuro


>From: "yohannes alazar" <[EMAIL PROTECTED]>
>To: r-help 
>Subject: [R] column to row
>Date: Mon, 14 Aug 2006 12:47:25 +0100
>
>Dear mailing list
>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
>
>   [[alternative HTML version deleted]]
>
>__
>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.

__
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.


Re: [R] column to row

2006-08-14 Thread Dimitris Rizopoulos
probably something like:

mat <- matrix(c(1:9, 1), 5, byrow = TRUE)
c(t(mat))


I hope it helps.

Best,
Dimitris


Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
 http://www.student.kuleuven.be/~m0390867/dimitris.htm


- Original Message - 
From: "yohannes alazar" <[EMAIL PROTECTED]>
To: "r-help" 
Sent: Monday, August 14, 2006 1:47 PM
Subject: [R] column to row


> Dear mailing list
> 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
>
> [[alternative HTML version deleted]]
>
> __
> 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.
> 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

__
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.


Re: [R] column to row

2006-08-14 Thread Paul Smith
On 8/14/06, yohannes alazar <[EMAIL PROTECTED]> 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,]16
[2,]27
[3,]38
[4,]49
[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.