Suppose you declared following function:
compound <- function(x,i,t) {
x*(1+i)^t
}
What are the fundamentals of following results:
compare(compound(100, 0.1, 2),121) => 'Equal'
and
identical(compound(100, 0.1, 2),121) => FALSE
In the package testthat expect_identical()
checks the second condition and returns a failure in that case, although the value is 121. What is a better alternative to verify the above function compound()
?