1

I have an s4 class object from ROCR package. It has several slots containing data that are related among each other (i.e. "x.values", "y.values", and "alpha.values").

I would like to merge them in a matrix by accessing the slots to make some calculations (Youden indices, etc.)

I've tried things like this (according to my limited knowledge of R)

test<-cbind(perf@x.values,perf@y.values,perf@alpha.values)

and other formulas such as changing the class of the object directly...

but anything worked.

4

1 回答 1

0

如果您知道插槽名称(getClass如果不知道则使用),您可以使用操作员将它们拉出来@。我不知道 ROCR 但假设您的插槽名称正确,您可以这样做

x <- perf@x.values
y <- perf@y.values
a <- perf@alpha.values

然后像任何其他 R 对象一样检查它们。您的 cbind 可能无法正常工作,因为对象的尺寸不匹配。

于 2013-07-25T14:48:13.307 回答