[R] converting a coloumn in a data set to a vector

arun smartpink111 at yahoo.com
Sat Dec 14 19:20:33 CET 2013


Hi,
Try:

dat1 <- read.table(text="x1 x2 x3
 1   5   7
 4   8   9
 8    6  12
 4   8   13",sep="",header=TRUE)
 vec1 <- dat1[,1]
 vec1
#[1] 1 4 8 4
A.K.


On Saturday, December 14, 2013 12:55 PM, Patty Haaem <elham_h763 at yahoo.com> wrote:
Hi every one,
I have a simple question. I want to make a vector from one of  the colomns in a data set. for example I have this data:
x1 x2 x3
1   5   7
4   8   9
8    6  12
4   8   13
 I want to convert x1 to a vector such as:
x1= c(1,4,8,4)
How I can do it?
Thanks
    [[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org 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.




More information about the R-help mailing list