Re: [R] changing colnames

2013-08-14 Thread farnoosh sheikhi
Thanks for the code. It was so simple and worked perfectly. I really appreciate it.   Best,Farnoosh Sheikhi Cc: R help 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

Re: [R] changing colnames

2013-08-14 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of arun > Sent: Wednesday, August 14, 2013 11:56 AM > To: farnoosh sheikhi > Cc: R help > Subject: Re: [R] changing colnames > > Hi, > You could try: &

Re: [R] changing colnames

2013-08-14 Thread arun
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.

Re: [R] changing colnames in dataframes

2008-12-04 Thread Wolfgang Lindner
thank you all, Jagat, Bert and Prof. Ripley for your kind help. The PROBLEM was: give descripitve names to the columns in JJ<-data.frame( c( as.character(rep( gender,3))) , c( F76,6- F83, F90) ) Possible SOLUTIONs are: 1.JJ <- data.frame( gender=c( as.character(rep( gender,3))) , J.value=c(

Re: [R] changing colnames in dataframes

2008-12-03 Thread Prof Brian Ripley
See the help page. You name the arguments, e.g. JJ <- data.frame( gender= c( as.character(rep( gender,3))) , J.value -c( F76 ,6-F83, F90) ) The help says Arguments: ...: these arguments are of either the form 'value' or 'tag = value'. Component names are crea

[R] changing colnames in dataframes

2008-12-03 Thread Wolfgang Lindner
dear all, I'm building new dataframes from bigger one's using e.g. columns F76, F83, F90: JJ<-data.frame( c( as.character(rep( gender,3))) , c( F76,6- F83, F90) ) Looking into JJ one has: c.as.character.rep.gender..8... c.6...F73..F78..F79..F82..6...F84..F94..F106..F109 1