OK, I'm feeling stupid this AM. Consider:
好吧,我觉得这个上午很蠢。考虑:
ppenv<-new.env(parent=.GlobalEnv)
assign('.dirhist','/Users/cgw/Rgames',ppenv)
ls(envir=ppenv)
character(0)
exists('.dirhist',envir=ppenv)
[1] TRUE
get('.dirhist',envir=ppenv)
[1] "/Users/cgw/Rgames"
So my question is: how do I determine the contents of my environment ppenv
, i.e. what objects exist there?
所以我的问题是:我如何确定我的环境ppenv的内容,即那里存在哪些对象?
1 个解决方案
#1
1
The problem is due to the object name beginning with a .
. Use the argument all.names = TRUE
:
问题是由于对象名称以...开头。使用参数all.names = TRUE:
ls(envir = ppenv, all.names = TRUE)
From the help page of ls
:
从ls的帮助页面:
all.names a logical value. If TRUE, all object names are returned. If FALSE, names which begin with a . are omitted.
all.names是一个逻辑值。如果为TRUE,则返回所有对象名称。如果为FALSE,则以a开头的名称。被省略。
#1
1
The problem is due to the object name beginning with a .
. Use the argument all.names = TRUE
:
问题是由于对象名称以...开头。使用参数all.names = TRUE:
ls(envir = ppenv, all.names = TRUE)
From the help page of ls
:
从ls的帮助页面:
all.names a logical value. If TRUE, all object names are returned. If FALSE, names which begin with a . are omitted.
all.names是一个逻辑值。如果为TRUE,则返回所有对象名称。如果为FALSE,则以a开头的名称。被省略。