On Sep 1, 2010, at 10:04 PM, Xiang Li wrote:
> Hi,
>
> Could you please tell me how to access the elements of a S4 object?
>
> Slot "alpha.name":
>
> [1] "Cutoff"
>
>
>
>> perf at alpha.values
>
> [[1]]
>
> [1] Inf 0.991096434 0.984667270 0.984599159 0.983494405
> 0.970641299 0.959417835 0.945548941 0.943432189
If that is the print() result of:
perf at alpha.values # then it's probably an ordinary list with a
single vector element, so just try
perf at alpha.values[[1]][2]
(The str function also works on S4 objects .)
--
David.
>
> [10] 0.938583020 0.932159806 0.930846938 0.912325837 0.911723615
> 0.907651100 0.905121019 0.890172812 0.890078186
>
> [19] 0.885179651 0.883431431 0.879459891 0.876086217 0.868751832
> 0.868331219 0.865639036 0.858970526 0.858876675
>
> I need to get the 2nd element of alpha.values, i.e, 0.991996434. by
> using @, I can get the whole array, but just can't get the access to
> the
> elements.
--
David Winsemius, MD
West Hartford, CT