[R] Accessing Vector of A Data Frame

Gundala Viswanath gundalav at gmail.com
Thu Sep 30 04:41:07 CEST 2010


I have a variable that looks like this:

> print(pred$posterior)
                 o            x
1     2.356964e-03 9.976430e-01
2     8.988153e-01 1.011847e-01
3     9.466137e-01 5.338627e-02
4     2.731429e-11 1.000000e+00

Now what I want to do is to access "o" and "x"

How come this approach fail?

> print(pred$posterior$o)

or

> print(pred$posterior[["o"]])

What's the right way to do it?

- G.V.



More information about the R-help mailing list