stripClass(tis)
stripClass()所属R语言包:tis
Remove part of a class attribute
类属性中删除部分
译者:生物统计家园网 机器人LoveR
描述----------Description----------
An R object may have a class attribute that is a character vector giving the names of classes it inherits from. stripClass strips the class classString from that character vector. stripTis(x) is shorthand for stripClass(x, "tis").
R对象可能有一个类属性,它是一个字符向量给从它继承的类的名称。 stripClass剥离类classString该字符向量。 stripTis(x)是简写为stripClass(x, "tis")。
用法----------Usage----------
stripClass(x, classString)
stripTis(x)
参数----------Arguments----------
参数:x
an object whose class character vector may or may not include classString
一个对象,其class字符向量可能会或可能不会包含classString
参数:classString
name of class to remove from the inheritance chain
类名的继承链中删除
值----------Value----------
An object like x, but whose class attribute does not include classString. If the class attribute less classString is empty, unclass(x) is returned.
类的物件x,但其class属性不包括classString。如果class属性少classString是空的,unclass(x)返回。
注意----------Note----------
This function can be useful in functions that return a modified version of one their arguments. For example, the format.ti method takes a ti (TimeIndex) as an argument and returns a character object object 'like' the original argument. The first thing format.ti(x) does internally is z <- stripClass(x, "ti"). This creates z as a copy of x but with the difference that z no longer inherits from class ti. The function then fills in the data elements of z with the approriate strings and returns it. The beauty of this approach is that the returned z already has all of the attributes x had, except that it no longer inherits from class ti. In particular, if x was a matrix with dimnames, etc., z will also have those attributes.
在一个它们的参数,返回一个修改后的版本的功能,此功能可能是有用的。例如,format.ti方法需要一个ti(TimeIndex)在作为参数,并返回一个字符对象的对象“,如”原始的参数。的第一件事format.ti(x)没有内部z <- stripClass(x, "ti")。这将创建z的副本x的但不同的是z,“不再继承自类ti。该函数然后填充的数据元素z与approriate字符串,并返回它。这种方法的优点是返回的z已经拥有的所有属性x了,不同的是它不再继承从类ti。特别是,如果x是一个矩阵与dimnames等,z将也有这些属性。
参见----------See Also----------
class
class
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|