Utilities for handling with classes
add_class(x, class) has_class(x, class) remove_class(x, class) set_class(x, class)
| x | An object |
|---|---|
| class | The class to add or remove |
The object x with the class added or removed.
add_class(): add a class to the object x keeping all the other class(es).
has_class(): Check if a class exists in object x and returns a logical value.
set_class(): set a class to the object x.
remove_class(): remove a class from the object x.
Tiago Olivoto tiagoolivoto@gmail.com
#> [1] "tbl_df" "tbl" "data.frame" "my_class"has_class(df, "my_class")#> [1] TRUE#> [1] "tbl_df" "tbl" "data.frame"#> [1] "data_frame"# }