[R] Stuck with levels while reassigning dataframe colnames?
jjap
jean.plamondon at fpinnovations.ca
Thu Feb 2 04:21:28 CET 2012
Dear users,
I am importing a csv file whose first row is a single value that I need to
capture in a variable.
infile<-file.choose()
in<-read.csv( infile, header=FALSE)
single.value<-as.character(in[1,1]) # fine
Now I need to take rows 3 and on as the data
df<-in[3:dim(in)[1],]
But row 2 contains what I want as header of df.
colnames(df)<-in[2,]
This gets a series of numbers (characters) "2" "5" "3" "11" instead of:
"CatA" "Time" etc.
I suspect this has something to do with levels, but I cannot seem to find a
way to get the proper names.
Any help or hint is appreciated.
--
View this message in context: http://r.789695.n4.nabble.com/Stuck-with-levels-while-reassigning-dataframe-colnames-tp4350435p4350435.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list