找回密码
 注册
查看: 623|回复: 0

R语言 Biobase包 updateObject()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-25 13:26:48 | 显示全部楼层 |阅读模式
updateObject(Biobase)
updateObject()所属R语言包:Biobase

                                        Update an object to its current class definition
                                         更新到当前的类定义的对象

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

These generic functions return an instance of object updated to its current class definition (or to the class definition of template, in the case of updateObjectTo).
这些通用的函数返回一个实例object更新其当前的类定义(或类定义template,在updateObjectTo的情况下)。

Updating objects is primarily useful when an object has been serialized (e.g., stored to disk) for some time (e.g., months), and the class definition has in the mean time changed. Because of the changed class definition, the serialized instance is no longer valid.
更新对象主要是有用的,当一个对象已经系列化一段时间(例如,月)(例如,存储到磁盘),并改变类定义的平均时间。因为类定义的改变,不再是有效的序列化实例。

updateObject requires that the class of the returned object be the same as the class of the argument object, and that the object is valid (see validObject). By default, updateObject has the following behaviors:
updateObject要求返回对象的类是同一类的说法object,而且对象是有效的(见validObject)。默认情况下,updateObject有下列行为:




updateObject(ANY, ..., verbose=FALSE) By default, updateObject uses heuristic methods to determine whether the object should be the "new" S4 type (introduced in R 2.4.0), but is not. If the heuristics indicate an update is required,  the updateObjectFromSlots function tries to update the object. The default method returns the original S4 object or the successfully updated object, or issues an error if an update is required but not possible. The optional named argument verbose causes a message to be printed describing
updateObject(ANY, ..., verbose=FALSE)默认情况下,updateObject使用启发式方法,以确定是否对象应该是“新”S4型(在R 2.4.0中引入),但不是。如果需要更新启发式表明,updateObjectFromSlots函数尝试更新的对象。默认的方法返回原来的S4对象或成功更新的对象,或者发出一个错误,如果需要更新,但不可能。可选的命名参数verbose导致消息被打印描述




updateObject(list, ..., verbose=FALSE) Visit each element in list,
updateObject(list, ..., verbose=FALSE)list访问每个元素,




updateObject(environment, ..., verbose=FALSE) Visit each element in environment, applying
updateObject(environment, ..., verbose=FALSE)访问environment每个元素,运用

updateObjectTo requires that the class of the returned object be the same as the class of the template argument, and that the object is valid. Usually, updating proceeds by modifying slots in template with information from object, and returning template. Use as to coerce an object from one type to another; updateObjectTo might be useful to update a virtual superclass. By default, updateObjectTo has the following behavior:
updateObjectTo需要,返回对象的类是同一类template参数,对象是有效的。通常,更新通过修改插槽所得template信息object,并返回template。使用as强迫一个对象从一个类型到另一个;updateObjectTo更新一个虚拟的超可能是有用的。默认情况下,updateObjectTo有下列行为:




updateObjectTo(ANY-object,ANY-template) Attempt as(ANY-object,class(ANY-template)).
updateObjectTo(ANY-object,ANY-template)尝试as(ANY-object,class(ANY-template))。

Sample methods are illustrated below.
抽样方法如下所示。

updateObjectFromSlots(object, objclass = class(object), ..., verbose=FALSE) is a utility function that identifies the intersection of slots defined in the object instance and objclass definition. The corresponding elements in object are then updated (with updateObject(elt, ..., verbose=verbose)) and used as arguments to a call to new(class, ...), with ... replaced by slots from the original object. If this fails, updateObjectFromSlots then tries new(class) and assigns slots of object to the newly created instance.
updateObjectFromSlots(object, objclass = class(object), ..., verbose=FALSE)是一个实用功能,标识路口object例如objclass定义定义的插槽。然后更新相应的元素object(updateObject(elt, ..., verbose=verbose))和使用作为到new(class, ...)的调用的参数,...更换插槽从原来的对象。如果失败,updateObjectFromSlots然后尝试new(class)和object新创建的实例分配插槽。

getObjectSlots(object) extracts the slot names and contents from object. This is useful when object was created by a class definition that is no longer current, and hence the contents of object cannot be determined by accessing known slots.
getObjectSlots(object)提取槽的名称和内容,从object。这是有用的,当object是创建一个类的定义不再是当前的,因此内容object不能由访问知名插槽确定。


用法----------Usage----------


updateObject(object, ..., verbose=FALSE)
updateObjectTo(object, template, ..., verbose=FALSE)
updateObjectFromSlots(object, objclass=class(object), ..., verbose=FALSE)
getObjectSlots(object)



参数----------Arguments----------

参数:object
Object to be updated, or for slot information to be extracted from.
对象进行更新,或插槽信息提取。


参数:template
Instance representing a template for updating object.
实例代表一个更新对象的模板。


参数:objclass
Optional character string naming the class of the object to be created.  
可选的字符串,命名要创建的对象的类。


参数:verbose
A logical, indicating whether information about the update should be reported. Use message to report this.
一个逻辑,说明是否有关更新的信息,应当报。使用message报告。


参数:...
Additional arguments, for use in specific update methods.
额外的参数,在使用特定的更新方法。


值----------Value----------

updateObject returns a valid instance of object. updateObjectTo returns a valid instance of template. updateObjectFromSlots returns an instance of class objclass. getObjectSlots returns a list of named elements, with each element corresponding to a slot in object.
updateObject返回一个object有效的实例。 updateObjectTo返回一个template有效的实例。 updateObjectFromSlots类objclass返回一个实例。 getObjectSlots返回命名的元素的列表,每个元素对应一个object插槽。


作者(S)----------Author(s)----------


Biocore team



参见----------See Also----------

Versions-class
Versions-class


举例----------Examples----------


## update object, same class[#更新对象,同一类。]
data(sample.ExpressionSet)
obj <- updateObject(sample.ExpressionSet)

setClass("UpdtA", representation(x="numeric"), contains="data.frame")
setMethod("updateObject", signature(object="UpdtA"),
          function(object, ..., verbose=FALSE) {
              if (verbose) message("updateObject object = 'A'")
              object <- callNextMethod()
              object@x <- -object@x
              object
})

a <- new("UpdtA", x=1:10)
## See steps involved[#涉及的步骤。]
updateObject(a)

removeClass("UpdtA")
removeMethod("updateObject", "UpdtA")

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-1-24 14:47 , Processed in 0.024280 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表