[R] Accessing Vector of A Data Frame
jim holtman
jholtman at gmail.com
Thu Sep 30 04:52:53 CEST 2010
Give us more information to work with. What does
str(pred$posterior)
show so that we can see the structure of the data. Is it a matrix, if
so then you would do
pred$posterior[, 'o']
On Wed, Sep 29, 2010 at 10:41 PM, Gundala Viswanath <gundalav at gmail.com> wrote:
> 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.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem that you are trying to solve?
More information about the R-help
mailing list