[R] De-data.fram-ize?

Peter Dalgaard p.dalgaard at biostat.ku.dk
Fri Sep 16 21:36:53 CEST 2005

Lukasz Komsta <luke at novum.am.lublin.pl> writes:

> Dear useRs,
> Is there any more elegant way to convert dataframe to a vector of all 
> its values than as.vector(as.matrix(x)) ? I did not have to do such 
> conversion yet, so I am not sure... (of course as.vector() alone does 
> not work).

unlist(x) should do it. It does spend a fair bit of effort in adding
names, so it could be less efficient.

   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907

More information about the R-help mailing list