Add an additional S3 class label to an object

class_add(x, new_class)

Arguments

x

An object to modify.

new_class

(character)
A name of a new class. May be a vector of names.

Examples

class_add(list("ok"), "ok_list")
#> [[1]]
#> [1] "ok"
#> 
#> attr(,"class")
#> [1] "ok_list" "list"