In packages like marray and limma, when complex objects are loaded, they contain "members variables" that are accessed using the @ symbol. What does this mean and how does it differ from the $ symbol?
在marray和limma这样的包中,当加载复杂对象时,它们包含使用@符号访问的“成员变量”。这意味着什么?它与$符号有何不同?
3 个解决方案
#1
28
See ?'@'
:
看到了什么?“@”:
-
Description:
描述:
Extract the contents of a slot in a object with a formal (S4) class structure.
提取具有正规(S4)类结构的对象中的槽的内容。
-
Usage:
用法:
object@name
object@name
...
…
The S language has two object systems, known informally as S3 and S4.
S语言有两个对象系统,非正式地称为S3和S4。
- S3 objects, classes and methods have been available in R from the beginning, they are informal, yet very interactive. S3 was first described in the White Book (Statistical Models in S).
- S3对象、类和方法从一开始就在R中可用,它们是非正式的,但是非常具有交互性。S3首先在白皮书中被描述(统计模型在S中)。
- S3 is not a real class system, it mostly is a set of naming conventions.
- S3不是一个真正的类系统,它主要是一组命名约定。
- S4 objects, classes and methods are much more formal and rigorous, hence less interactive. S4 was first described in the Green Book (Programming with Data). In R it is available through the
methods
package, attached by default since version 1.7.0. - S4对象、类和方法更加正式和严格,因此不具有交互性。S4首先在绿皮书中被描述(用数据编程)。在R中,它可以通过methods包获得,默认情况下,自1.7.0版以来都是附加的。
See also this document: S4 Classes and Methods.
请参见本文档:S4类和方法。
#2
8
As the others have said, the @ symbol is used with S4 classes, but here is a note from Google's R Style Guide: "Use S3 objects and methods unless there is a strong reason to use S4 objects or methods."
正如其他人所说,@符号用于S4类,但是这里有来自谷歌的R样式指南的说明:“使用S3对象和方法,除非有充分的理由使用S4对象或方法。”
#3
5
You will want to read up on S4 classes which use the @ symbol.
您将希望阅读使用@符号的S4类。
#1
28
See ?'@'
:
看到了什么?“@”:
-
Description:
描述:
Extract the contents of a slot in a object with a formal (S4) class structure.
提取具有正规(S4)类结构的对象中的槽的内容。
-
Usage:
用法:
object@name
object@name
...
…
The S language has two object systems, known informally as S3 and S4.
S语言有两个对象系统,非正式地称为S3和S4。
- S3 objects, classes and methods have been available in R from the beginning, they are informal, yet very interactive. S3 was first described in the White Book (Statistical Models in S).
- S3对象、类和方法从一开始就在R中可用,它们是非正式的,但是非常具有交互性。S3首先在白皮书中被描述(统计模型在S中)。
- S3 is not a real class system, it mostly is a set of naming conventions.
- S3不是一个真正的类系统,它主要是一组命名约定。
- S4 objects, classes and methods are much more formal and rigorous, hence less interactive. S4 was first described in the Green Book (Programming with Data). In R it is available through the
methods
package, attached by default since version 1.7.0. - S4对象、类和方法更加正式和严格,因此不具有交互性。S4首先在绿皮书中被描述(用数据编程)。在R中,它可以通过methods包获得,默认情况下,自1.7.0版以来都是附加的。
See also this document: S4 Classes and Methods.
请参见本文档:S4类和方法。
#2
8
As the others have said, the @ symbol is used with S4 classes, but here is a note from Google's R Style Guide: "Use S3 objects and methods unless there is a strong reason to use S4 objects or methods."
正如其他人所说,@符号用于S4类,但是这里有来自谷歌的R样式指南的说明:“使用S3对象和方法,除非有充分的理由使用S4对象或方法。”
#3
5
You will want to read up on S4 classes which use the @ symbol.
您将希望阅读使用@符号的S4类。