【发布时间】: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