"at" 符号 @ 在 R 中代表什么?

what does "at" sign @ stand for in R?

我想了解 R 中“@”(at 符号)的功能。
比方说:
在下面的示例中,如果我调用 perf1@x.values,它会开始显示所有 x.values。但我无法通过调用 perf@x.values[2] 访问 x.values 的第二个值!

> str(perf1)
Formal class 'performance' [package "ROCR"] with 6 slots
  ..@ x.name      : chr "False positive rate"
  ..@ y.name      : chr "True positive rate"
  ..@ alpha.name  : chr "Cutoff"
  ..@ x.values    :List of 1
  .. ..$ : num [1:3966] 0 0.0005 0.001 0.0015 0.0015 0.002 0.0025 0.0025 0.003 0.0035 ...
  ..@ y.values    :List of 1
  .. ..$ : num [1:3966] 0e+00 0e+00 0e+00 0e+00 5e-04 5e-04 5e-04 1e-03 1e-03 1e-03 ...
  ..@ alpha.values:List of 1
  .. ..$ : num [1:3966] Inf 0.996 0.993 0.986 0.98 ...

我想知道“@”符号在 R 中的用法是什么?
以及如何使用@符号调用某些值?
谢谢

S4 objects are lists with nodes or leaves (which are technically calls 'slots') that are accessible with the @ operator just as S3 objects are accessed with $.

看看:

str( perf1@x.name )
str( perf1@y.name )

请注意,这些可能包含普通的 S3 列表,例如:

str( perf1 @ x.values) # a list
str( perf1 @ x.values[[1]] ) # a numeric vector
perf1 @ x.values[[1]][1]   # the first value in `x.values`

这样做被认为是一种糟糕的形式,因为 S4 对象的作者应该 为您配备访问函数,使您能够获得任何有用的东西。