Remove part of a class attribute
An R object may have a class attribute that is a character
vector giving the names of classes it inherits from.
strips the class
classString from that character vector.
stripTis(x) is shorthand for
an object whose
name of class to remove from the inheritance chain
An object like
x, but whose
class attribute does
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
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").
z as a copy of
x but with the difference
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
z already has all of the attributes
except that it no longer inherits from class
x was a matrix with dimnames, etc.,
will also have those attributes.
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.