Learn R Programming

DescTools (version 0.99.19)

AddClass: Add and Remove Classes From an Object

Description

A simple wrapper for adding and removing classes from an object.

Usage

AddClass(x, class, after = 0) RemoveClass(x, class)

Arguments

x
a R object

class
a character vector naming classes.

after
a subscript, after which the class(es) are to be appended.

See Also

class, append

Examples

Run this code
x <- letters[1:5]
x <- AddClass(x, c("special", "letter"))
class(x)

x <- RemoveClass(x, "character")
class(x)

Run the code above in your browser using DataLab