I've searched for the answer to this in the help list archive, but wasn't
able to get the answer to work.
I'm interested in converting a row of a data.frame into a vector.
However, when I use as.vector(x,[1,]) I get another data.frame, instead of a
vector. (On the other hand, when I use
probably something like,
unlist(x[1,])
HTH.
H.
Andrew Yee [EMAIL PROTECTED] 5/15/2007 4:37 PM
I've searched for the answer to this in the help list archive, but wasn't
able to get the answer to work.
I'm interested in converting a row of a data.frame into a vector.
However, when I use
If the data frame has factors and numeric vectors, there is a question
on what form you want the row vector to be in. Only a data frame (list)
can have a mixture of the two.
Consider:
dat - data.frame(x=1:3, y=4:6, z=letters[1:3])
(r1 - dat[1,])
x y z
1 1 4 a
class(r1)
[1] data.frame
(r1