Hi,

I have an object from the prediction function from the ROCR package and I would 
like to extract one of the slots from the object, for example the cutoffs slot. 
However the usual techniques ($, [["name"]]) of subsetting don't work. How can 
I assess the lists in the slots?

Here is an example of what I am working with:

library(ROCR)
data(ROCR.simple)
pred <- prediction(ROCR.simple$predictions,ROCR.simple$labels)

> str(pred)
Formal class 'prediction' [package "ROCR"] with 11 slots
  ..@ predictions:List of 1
  .. ..$ : num [1:200] 0.613 0.364 0.432 0.140 0.385 ...
  ..@ labels     :List of 1
  .. ..$ : Ord.factor w/ 2 levels "0"<"1": 2 2 1 1 1 2 2 2 2 1 ...
  ..@ cutoffs    :List of 1
  .. ..$ : num [1:201]   Inf 0.991 0.985 0.985 0.983 ...
  ..@ fp         :List of 1
  .. ..$ : num [1:201] 0 0 0 0 1 1 2 3 3 3 ...
  ..@ tp         :List of 1
  .. ..$ : num [1:201] 0 1 2 3 3 4 4 4 5 6 ...
  ..@ tn         :List of 1
  .. ..$ : num [1:201] 107 107 107 107 106 106 105 104 104 104 ...
  ..@ fn         :List of 1
  .. ..$ : num [1:201] 93 92 91 90 90 89 89 89 88 87 ...
  ..@ n.pos      :List of 1
  .. ..$ : int 93
  ..@ n.neg      :List of 1
  .. ..$ : int 107
  ..@ n.pos.pred :List of 1
  .. ..$ : num [1:201] 0 1 2 3 4 5 6 7 8 9 ...
  ..@ n.neg.pred :List of 1
  .. ..$ : num [1:201] 200 199 198 197 196 195 194 193 192 191 ...
> 

Thanks in advance,
Stacey

       
---------------------------------

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to