Description Usage Arguments Value Note Examples
View source: R/verify_expected.R
Function to check a set of predictions for a set of expected predictions (e.g. targets, locations)
1 | verify_expected(x, expected_list, return_df = FALSE, print_output = !return_df)
|
x |
predx_df |
expected_list |
list of lists (see Note) |
return_df |
if |
print_output |
if |
If any predictions in expected_list
are not found or if additional predictions are found, the function will print the missing and/or additional rows (print_out = TRUE
) or return a data frame with a status designation for each missing and/or additional row (return_df = TRUE
).
expected_list
is a two-level list of sets of expected predictions.
The lower level (e.g. expected_list[[1]]
) is a list of named character vectors
with specific expected predictions. The names should match column names
in x
. The function checks that all combinations of those elements are
present in x
. A named vector predx_class
may be used to check
predx types.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | predx_demo <- as.predx_df(list(
location = c("Mercury", "Venus", "Earth"),
target = "habitability",
predx = list(Binary(1e-4), Binary(1e-4), Binary(1))
))
expected_demo <- list(
list(
location = c("Mercury", "Venus", "Earth"),
target = "habitability",
predx_class = "Binary"
)
)
expected_demo2 <- list(
list(
location = c("Mercury", "Mars"),
target = "habitability",
predx_class = "Binary"
)
)
verify_expected(predx_demo, expected_demo)
verify_expected(predx_demo, expected_demo2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.