【问题标题】:List of special/reserved attributes in R?R中的特殊/保留属性列表?
【发布时间】:2019-09-18 02:03:27
【问题描述】:

我正在通过“高级 R”一书了解 R 属性。正如标题所说,问题是我如何找到保留的属性(具有一些特殊属性的属性)。例如:

structure(1:5, test.attribute = 'test')

返回:

#> [1] 1 2 3 4 5
#> attr(,"test.attribute")
#> [1] "test"

但是对于:

structure(1:5, comment = 'my attribute')

返回:

#> [1] 1 2 3 4 5

所以我认为'comment'作为属性名称附加了一些特殊的东西,我想看看是否还有更多这样的保留字。

我最终查看了源代码 (https://github.com/wch/r-source/blob/27da0eac8bb84677002febcf12e6d61bb7358d89/src/main/attrib.c?),但我想我没有足够的知识来理解它。

【问题讨论】:

    标签: r attributes


    【解决方案1】:

    它是一个不被打印的特殊属性。甚至还有一个专用的function 来检索和设置它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-11
      • 2014-04-26
      • 2019-11-24
      • 2011-05-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多