## R reference
rref <- bibentry(bibtype = "Manual",
title = "R: A Language and Environment for Statistical Computing",
author = person("R Development Core Team"),
organization = "R Foundation for Statistical Computing",
address = "Vienna, Austria",
year = 2010,
isbn = "3-900051-07-0",
url = "http://www.R-project.org/")
> str(rref)
Class 'bibentry' hidden list of 1
$ :List of 7
..$ title : chr "R: A Language and Environment for Statistical Computing"
..$ author :Class 'person' hidden list of 1
.. ..$ :List of 5
.. .. ..$ given : chr "R Development Core Team"
.. .. ..$ family : NULL
.. .. ..$ role : NULL
.. .. ..$ email : NULL
.. .. ..$ comment: NULL
..$ organization: chr "R Foundation for Statistical Computing"
..$ address : chr "Vienna, Austria"
..$ year : chr "2010"
..$ isbn : chr "3-900051-07-0"
..$ url : chr "http://www.R-project.org/"
..- attr(*, "bibtype")= chr "Manual"
Run Code Online (Sandbox Code Playgroud)
特别是,我对此感到困惑:
> str(rref)
Class 'bibentry' hidden list of 1
$ :List of 7
Run Code Online (Sandbox Code Playgroud)
" hidden list"位指的是什么?这是什么样的对象?这只是一些格式输出,str()当对象中只有一个组件本身就是一个列表时?如果是这样,怎么有办法强制str()显示完整的结构?
And*_*rie 10
这似乎是一个人工制品str.我的解释是,如果对象不是a hidden list,str则在输出中打印出单词pairlist.
由于您的对象是类bibtex,并且没有str方法bibtex,因此该方法utils:::str.default用于描述结构.
浓缩提取物来自str.default:
...
if (is.list(object)) {
i.pl <- is.pairlist(object)
...
cat(if (i.pl)
"Dotted pair list"
else if (irregCl)
paste(pClass(cl), "hidden list")
else "List", " of ", le, "\n", sep = "")
...
}
Run Code Online (Sandbox Code Playgroud)
定义的关键位irregCl是:
....
else {
if (irregCl <- has.class && identical(object[[1L]],
object)) {
....
Run Code Online (Sandbox Code Playgroud)
并且解释隐藏列表位-它隐藏了外列表中,如果对象具有类和object和object[[1]]是相同的.正如您在链接到的答案中所示,[[如果列表包含单个"bibentry"对象,则该方法返回相同的对象.