Utilities for handling with classes
Details
add_class()
: add a class to the objectx
keeping all the other class(es).has_class()
: Check if a class exists in objectx
and returns a logical value.set_class()
: set a class to the objectx
.remove_class()
: remove a class from the objectx
.
Author
Tiago Olivoto tiagoolivoto@gmail.com
Examples
# \donttest{
library(metan)
df <-
data_ge2 %>%
add_class("my_class")
class(df)
#> [1] "tbl_df" "tbl" "data.frame" "my_class"
has_class(df, "my_class")
#> [1] TRUE
remove_class(df, "my_class") %>% class()
#> [1] "tbl_df" "tbl" "data.frame"
set_class(df, "data_frame") %>% class()
#> [1] "data_frame"
# }