getPackageName(methods)
getPackageName()所属R语言包:methods
The Name associated with a Given Package
一个给定的包关联的名称
译者:生物统计家园网 机器人LoveR
描述----------Description----------
The functions below produce the package associated with a particular environment or position on the search list, or of the package containing a particular function. They are primarily used to support computations that need to differentiate objects on multiple packages.
以下功能产生搜索列表中,或包含特定功能的包的位置与特定的环境或相关联的包。它们主要用于支持计算,需要区分多个包的对象。
用法----------Usage----------
getPackageName(where, create = TRUE)
setPackageName(pkg, env)
packageSlot(object)
packageSlot(object) <- value
参数----------Arguments----------
参数:where
the environment or position on the search list associated with the desired package.
环境或位置所需的软件包相关的搜索列表。
参数:object
object providing a character string name, plus the package in which this object is to be found.
反对提供一个字符串名称,再加上这是要找到对象的包。
参数:value
the name of the package.
包的名称。
参数:create
flag, should a package name be created if none can be inferred? If TRUE and no non-empty package name is found, the current date and time are used as a package name, and a warning is issued. The created name is stored in the environment if that environment is not locked.
标志,应该可以推断,如果没有创建包名?如果TRUE并没有发现非空的包名,当前日期和时间被用来作为一个包的名称,并发出警告。创建的名称存储在环境,如果环境不被锁定。
参数:pkg, env
make the string in pkg the internal package name for all computations that set class and method definitions in environment env.
字符串pkg所有的计算环境env设置类和方法定义内部包的名称。
Details
详情----------Details----------
Package names are normally installed during loading of the package, by the INSTALL script or by the library function. (Currently, the name is stored as the object .packageName but don't trust this for the future.)
包名通常是在安装过程中加载的包,安装脚本或library功能。 (目前的名称是存储对象.packageName,但不相信这对未来的。)
值----------Value----------
packageName returns the character-string name of the package (without the extraneous "package:" found in the search list).
packageName返回软件包的字符串的名称(不带多余的"package:"在搜索列表中找到)。
packageSlot returns or sets the package name slot (currently an attribute, not a formal slot, but this may change someday).
packageSlot返回或设置包名插槽(目前的属性,不是一个正式的插槽,但是这可能会改变一天)。
setPackageName can be used to establish a package name in an environment that would otherwise not have one. This allows you to create classes and/or methods in an arbitrary environment, but it is usually preferable to create packages by the standard R programming tools (package.skeleton, etc.)
setPackageName可以用来建立的环境中,否则将不会有一个包名称。这可以让你创建类和/或在任意环境的方法,但它通常是可取的创建标准的R编程工具(的package.skeleton,等)的包
参见----------See Also----------
search
search
举例----------Examples----------
## all the following usually return "base"[#以下所有通常返回“基地”]
getPackageName(length(search()))
getPackageName(baseenv())
getPackageName(asNamespace("base"))
getPackageName("package:base")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|