[R] extracting named vector from dataframe

Gabor Grothendieck ggrothendieck at gmail.com
Sun Oct 31 19:15:01 CET 2010


On Sun, Oct 31, 2010 at 12:11 PM, baptiste auguie
<baptiste.auguie at googlemail.com> wrote:
> Hi,
>
> I think you want ?unlist
>
> d = data.frame(x=1, y=2, z=3)
> v = unlist(d)
> is(v)
> [1] "numeric" "vector"
>

Here are a few other possibilities too:

   drop(as.matrix(d))

   do.call("c", d)

   sapply(d, identity)

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list