utils_class {metan} | R Documentation |
Utilities for handling with classes
Description
Utilities for handling with classes
Usage
add_class(x, class)
has_class(x, class)
remove_class(x, class)
set_class(x, class)
Arguments
x |
An object |
class |
The class to add or remove |
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
.
Value
The object x
with the class added or removed.
Author(s)
Tiago Olivoto tiagoolivoto@gmail.com
Examples
library(metan)
df <-
data_ge2 %>%
add_class("my_class")
class(df)
has_class(df, "my_class")
remove_class(df, "my_class") %>% class()
set_class(df, "data_frame") %>% class()
[Package metan version 1.18.0 Index]