Check if an argument is a R6 class
Check if an argument is a R6 class
checkR6( x, classes = NULL, ordered = FALSE, cloneable = NULL, public = NULL, private = NULL, null.ok = FALSE ) check_r6( x, classes = NULL, ordered = FALSE, cloneable = NULL, public = NULL, private = NULL, null.ok = FALSE ) assertR6( x, classes = NULL, ordered = FALSE, cloneable = NULL, public = NULL, private = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_r6( x, classes = NULL, ordered = FALSE, cloneable = NULL, public = NULL, private = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) testR6( x, classes = NULL, ordered = FALSE, cloneable = NULL, public = NULL, private = NULL, null.ok = FALSE ) test_r6( x, classes = NULL, ordered = FALSE, cloneable = NULL, public = NULL, private = NULL, null.ok = FALSE ) expect_r6( x, classes = NULL, ordered = FALSE, cloneable = NULL, public = NULL, private = NULL, null.ok = FALSE, info = NULL, label = vname(x) )
x |
[any] |
classes |
[ |
ordered |
[ |
cloneable |
[ |
public |
[ |
private |
[ |
null.ok |
[ |
.var.name |
[ |
add |
[ |
info |
[character(1)] |
label |
[ |
Depending on the function prefix:
If the check is successful, the functions
assertClass
/assert_class
return
x
invisibly, whereas
checkClass
/check_class
and
testClass
/test_class
return
TRUE
.
If the check is not successful,
assertClass
/assert_class
throws an error message,
testClass
/test_class
returns FALSE
,
and checkClass
returns a string with the error message.
The function expect_class
always returns an
expectation
.
Other classes:
checkClass()
,
checkMultiClass()
library(R6) generator = R6Class("Bar", public = list(a = 5), private = list(b = 42), active = list(c = function() 99) ) x = generator$new() checkR6(x, "Bar", cloneable = TRUE, public = "a")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.