verify | R Documentation |
Checks whether code in teal_data
object reproduces the stored objects.
verify(x)
x |
|
If objects created by code in the @code
slot of x
are all_equal
to the contents of the @env
slot,
the function updates the @verified
slot to TRUE
in the returned teal_data
object.
Once verified, the slot will always be set to TRUE
.
If the @code
fails to recreate objects in teal_data@env
, an error is raised.
Input teal_data
object or error.
tdata1 <- teal_data()
tdata1 <- within(tdata1, {
a <- 1
b <- a^5
c <- list(x = 2)
})
verify(tdata1)
tdata2 <- teal_data(x1 = iris, code = "x1 <- iris")
verify(tdata2)
verify(tdata2)@verified
tdata2@verified
tdata3 <- teal_data()
tdata3 <- within(tdata3, {
stop("error")
})
try(verify(tdata3)) # fails
a <- 1
b <- a + 2
c <- list(x = 2)
d <- 5
tdata4 <- teal_data(
a = a, b = b, c = c, d = d,
code = "a <- 1
b <- a
c <- list(x = 2)
e <- 1"
)
tdata4
## Not run:
verify(tdata4) # fails
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.