简体   繁体   English

@符号在R中是什么意思?

[英]What does the @ symbol mean in R?

In packages like marray and limma , when complex objects are loaded, they contain "members variables" that are accessed using the @ symbol. 在诸如marray和limma之类的包中,当加载复杂对象时,它们包含使用“ @”符号访问的“成员变量”。 What does this mean and how does it differ from the $ symbol? 这是什么意思?它与$符号有何不同?

See ?'@' : 参见?'@'

  • Description: 描述:

    Extract the contents of a slot in a object with a formal (S4) class structure. 提取具有正式(S4)类结构的对象中插槽的内容。

  • Usage: 用法:

    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对象,类和方法从一开始就已在R中可用,它们是非正式的,但非常互动 S3 was first described in the White Book (Statistical Models in S). 白皮书 (S中的统计模型)中首先描述了S3。
  • 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对象,类和方法更为正式和严格,因此交互性较低 S4 was first described in the Green Book (Programming with Data). S4首先在绿皮书 (使用数据编程)中进行了描述。 In R it is available through the methods package, attached by default since version 1.7.0. 在R中,它可以通过methods包获得,默认情况下自1.7.0版开始附带。

See also this document: S4 Classes and Methods . 另请参见本文档: S4类和方法

正如其他人所说的,@符号用于S4类,但这是Google R风格指南的注释:“除非有充分的理由使用S4对象或方法,否则请使用S3对象和方法。”

您将需要阅读使用@符号的S4类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM