[R] Turning Data Frame Columns into Vectors
jawbonemurphy
jdurlandster at gmail.com
Sat Oct 15 22:07:25 CEST 2011
Hi,
I converted an Excel file into a .txt file "X.txt" with no header (
http://r.789695.n4.nabble.com/file/n3908157/X.txt X.txt ) and imported it
with:
X <- read.table("/Users/johnlogandurland/Desktop/X.txt", header=FALSE).
What I would like to do is to make the first column into a factors vector,
and then analyze the rest of the columns in the data table using those
factors. The problem is, I haven't found a way to convert the rest of the
columns into vectors with length = nrows so I can apply the factors vector
to them.
When I try:
vect <- X[1]
I get an object with class "data.frame" and length 1, and the "[[]]" command
seems to turn the column into a "factor" vector, though with the right
length. This seems like it should be a really easy thing to do, but I've
looked through R-intro and been unable to find a good answer. Any ideas?
Many Thanks,
Logan
--
View this message in context: http://r.789695.n4.nabble.com/Turning-Data-Frame-Columns-into-Vectors-tp3908157p3908157.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list