Reproducibility check
NEST CoreDev
2022-04-20
reproducibility.Rmd
Reproducibility check
Mechanism
teal.data
classes that accumulate raw data accept a
boolean check
argument, e.g. [teal_data()]. This boolean
flag indicates whether teal
performs validation of the data
passed to the TealData
object during launch of a
teal
application.
The validation compares the raw data passed to the class with the dataset returned by the code stored in the class. E.g.:
library(teal.data)
iris_ds <- dataset("iris", iris, code = "iris <- iris")
data <- teal_data(iris_ds, check = TRUE)
data$check() # returns TRUE
The check()
method called during launch can be invoked
directly and returns TRUE
if the raw data passed to
teal_data
matches the return value of the code stored in
the class. It returns an error if the comparison fails and
NULL
if the check = FALSE
was passed to
teal_data
.
# throws an error:
# Error in x$check_reproducibility() : Reproducibility check failed.
data <- teal_data(dataset("iris", iris, code = "iris <- mtcars"), check = TRUE)
data <- teal_data(dataset("iris", iris, code = "iris <- mtcars"), check = FALSE)
data$check() # returns NULL even though the code does not match the raw data
Find out more in the teal_data()
documentation.