Thanks for the code. It was so simple and worked perfectly.
I really appreciate it.
 
Best,Farnoosh Sheikhi


________________________________


Cc: R help <r-help@r-project.org> 
Sent: Wednesday, August 14, 2013 11:56 AM
Subject: Re: changing colnames


Hi,
You could try:
dat1<- read.table(text="
X1,X2,X3
age,race,stat
12,2,35
17,6,55
",sep=",",header=TRUE,stringsAsFactors=FALSE)
colnames(dat1)<- dat1[1,]
 dat1<- dat1[-1,]
dat1[]<-lapply(dat1,as.numeric)
row.names(dat1)<- 1:nrow(dat1)
 dat1
#  age race stat
#1  12    2   35
#2  17    6   55
A.K.






________________________________


Sent: Wednesday, August 14, 2013 2:45 PM
Subject: changing colnames



Hi Arun,

I have a data set as follow:

X1 X2 X3
age race stat
12235
17655

The column names are currently  X1 X2 X3, but I want to drop them and have age, race and stat as column names, like below:

age race stat
12235
17655

Do you know how to do that?
Thanks a lot. 
	[[alternative HTML version deleted]]

