[R] Reading then transposing from file
dion at thewhimwham.com
Sat Mar 17 10:27:39 CET 2012
I'm an R beginner and I'm struggling with what should be a rudimentary task.
My data is along these lines:
ID name1 name2 name3 name4
Class 0 1 0 2
Var1 A B C A
Var2 B C C A
Var3 C A B A
I'm using the following:
foo <- data.frame(t(read.table("file", header=FALSE)))
but of course now it's not using ID, Class, etc. as column names.
As you can imagine, I'd like to be able to use, say, foo$Var2 or foo$ID.
What's the best way to achieve this?
View this message in context: http://r.789695.n4.nabble.com/Reading-then-transposing-from-file-tp4480313p4480313.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help