Description Usage Arguments Value Note See Also
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")
.
1 2 | stripClass(x, classString)
stripTis(x)
|
x |
an object whose |
classString |
name of class to remove from the inheritance chain |
An object like x
, but whose class
attribute does
not include classString
. If the class
attribute less
classString
is empty, unclass(x)
is returned.
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.