0

I have an S4 class object:

    class(pred)
      [1] "prediction"
      attr(,"package")
      [1] "ROCR"

and pred has following columns

slotNames(pred)
 #[1] "predictions" "labels"      "cutoffs"     "fp"          "tp"          "tn"          "fn"         
 #[8] "n.pos"       "n.neg"       "n.pos.pred"  "n.neg.pred" 

pred has around 10K rows. Now I want to get records which has predictions > 0.5

How I can subset this?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Sourabh
  • 73
  • 1
  • 18
  • hello, try `unlist(pred@predictions) > 0.5` – s.brunel Aug 30 '16 at 14:05
  • Hi Brunel, Thank you for your reply. class of the output, of this command, is logical. However, i am expecting class of the subset to remain same as the class of pred. Also, I want to access all the columns, such as fp, tp, of the subset – Sourabh Aug 31 '16 at 02:35
  • you 'll need to create a custom subset function probably check this post http://stackoverflow.com/questions/10961842/how-to-define-the-subset-operators-for-a-s4-class – s.brunel Aug 31 '16 at 08:44

0 Answers0