[R] how to operate a S4 objecti
David Winsemius
dwinsemius at comcast.net
Wed Feb 3 20:10:05 CET 2010
On Feb 3, 2010, at 12:25 PM, Hongbin Zhang wrote:
> I have a R object which has a value (see below, e.g., the
> "0.8341875") I like to extract to put into a simple form, e.g., an
> array.
>
> how could I do that?
>
> below is the code:
>
>> library(ROCR)
>> data(ROCR.simple)
>> pred <- prediction( ROCR.simple$predictions, ROCR.simple$labels)
>> auc <- performance(pred,"auc")
>> auc
> arr <- array(, dim=c(3,3,3) )
> arr[1,1,1] <- auc at y.values[[1]]
> arr
, , 1
[,1] [,2] [,3]
[1,] 0.8341875 NA NA
[2,] NA NA NA
[3,] NA NA NA
, , 2
[,1] [,2] [,3]
[1,] NA NA NA
[2,] NA NA NA
[3,] NA NA NA
, , 3
[,1] [,2] [,3]
[1,] NA NA NA
[2,] NA NA NA
[3,] NA NA NA
>
> An object of class performance
>
> [1] "None"
>
> Slot "y.name":
> [1] "Area under the ROC curve"
>
> Slot "alpha.name":
> [1] "none"
>
> Slot "x.values":
> list()
>
> Slot "y.values":
> [[1]]
> [1] 0.8341875
>
>
> Slot "alpha.values":
> list()
>
> ______________________________________________
> 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.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list