Question: library ( testthat ) #in case you forgot to run the first cell ( but please run it anyways ) if ( test _ that

library(testthat) #in case you forgot to run the first cell (but please run it anyways)
if (test_that(desc="", code={
expect_equal(is.vector(x), TRUE)
expect_equal(is.vector(y), TRUE)
})!= TRUE) stop("Sorry, x or y was not created as a vector")
if (test_that(desc="", code={
expect_equal(is.numeric(x), TRUE)
expect_equal(is.numeric(y), TRUE)
})!= TRUE) stop("Sorry, x or y is not numeric")
if (test_that(desc="", code={
expect_equal(length(x),100)
expect_equal(length(y),100)
})!= TRUE) stop("Sorry, wrong length for at least one of the vectors")

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!