Description Usage Arguments Details Examples
Use validate_S3(), check_S3(), test_S3(), assert_S3(), expect_S3() and need_S3() to validate S3 objects from this package.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
x |
An object with one of the pensieve S3 classes. |
... |
further arguments to be passed to methods. |
ps_coll |
|
info |
[ |
label |
[ |
collection |
[ |
var.name |
[ |
All S3 classes in pensieve have validate_S3() methods, which return NULL on success, or a character vector of arbitrary length with validation failures.
Five alternative generics use the same underlying validate_S3() methods, but differ in their returns:
checkmate package extensions:
check_S3() returns TRUE or the error message as a character string,
assert_S3() returns x invisibly or throws an error,
test_S3() returns TRUE or FALSE,
testthat) package extension:
expect_S3() always returns an testthat::expectation() for internal use in testing,
shiny package extension:
need_S3() returns NULL or the error message for internal use with the accio web frontend inside shiny::validate().
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # just for testing; never build objects like this by hand
good_obj <- psItemContent(items = "I am an item")
bad_obj <- structure(
.Data = 1L, # must be character
class = c("psItemContentText", "psItemContent", "character")
)
validate_S3(good_obj)
validate_S3(bad_obj)
check_S3(good_obj)
check_S3(bad_obj)
test_S3(good_obj)
test_S3(bad_obj)
expect_S3(good_obj)
# expect_S3(bad_obj) # this errors out
assert_S3(good_obj)
# assert_S3(bad_obj) # this errors out
need_S3(good_obj)
need_S3(bad_obj)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.