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.
________________________________ From: farnoosh sheikhi <farnoosh...@yahoo.com> To: "smartpink...@yahoo.com" <smartpink...@yahoo.com> 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. ______________________________________________ R-help@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.