How to convert vector from 1-row table in R
Question
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!
Solution
or you could use as.vector(x)
OTHER TIPS
It already is a vector.
tbl <- table(rpois(100, 10))
tbl[1]
tbl[2:5]
tbl[tbl > 10]
If the table is named x, then just use c(x).
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow