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. ______________________________________________ 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.