# NOT RUN {
verify(mtcars, drat > 2) # returns mtcars
# }
# NOT RUN {
verify(mtcars, drat > 3) # produces error
# }
# NOT RUN {
library(magrittr) # for piping operator
# }
# NOT RUN {
mtcars %>%
verify(drat > 3) %>%
# anything here will not run
# }
# NOT RUN {
mtcars %>%
verify(nrow(mtcars) > 2)
# anything here will run
alist <- list(a=c(1,2,3), b=c(4,5,6))
verify(alist, length(a) > 2)
verify(alist, length(a) > 2 && length(b) > 2)
verify(alist, a > 0 & b > 2)
# }
# NOT RUN {
alist %>%
verify(alist, length(a) > 5)
# nothing here will run
# }
# NOT RUN {
# }
Run the code above in your browser using DataCamp Workspace