views:

676

answers:

3

In R, I have a 1-row table. How do I convert that to a vector?

Specifically, the table is this:

 0  1  2  3  4 
21 35 46 62 36

I've tried bracket notation but to no avail!

+2  A: 

If the table is named x, then just use c(x).

Rob Hyndman
Wow, thanks! :D
Teef L
This is bad style - you shouldn't use `c()` for the side effect of stripping attributes. Be explicit and use `as.vector()`
hadley
+1  A: 

or you could use as.vector(x)

rcs
+3  A: 

It already is a vector.

tbl <- table(rpois(100, 10))
tbl[1]
tbl[2:5]
tbl[tbl > 10]
hadley