Skip to content
Prev 308779 / 398503 Next

Join data frame columns

I don't think so. The OP wanted the list by columns, not rows, if I
understand correctly.

unlist(df)

provides this. Of course, the request probably does not makes sense in
the first place, as the different types/classes in the data.frame will
be coerced to one type/class. Moreover, factors will become numeric
(is this what motivated the original request??):
a b
1 1 a
2 2 b
3 3 c
a1 a2 a3 b1 b2 b3
 1  2  3  1  2  3

So, a guess would be that the OP wants:
a1  a2  a3  b1  b2  b3
"1" "2" "3" "a" "b" "c"

But without the requested reproducible example, this is only a guess.
Again, note the coercion of numerics to character.

I would also guess that the OP might benefit by reading the Intro to R
tutorial and the data frame section of the R Language Definition
Manual -- and perhaps ?data.frame -- to better understand the nature
of data frames and what can and cannot be done with them.

Of course, I may have missed the mark altogether, in which case, please ignore.

-- Bert
On Tue, Oct 23, 2012 at 6:48 AM, Rui Barradas <ruipbarradas at sapo.pt> wrote: