Error in `if (all(tim > 0)) {     cat("Relative time difference:", (tim2 - tim)/tim, "\n") }`: missing value where TRUE/FALSE needed

test_that("Drawing from the posterior in one as well as in multiple calls to fsvsample()", {
sim <- fsvsim(factors = factors, series = 5)
cat("Drawing in one call to fsvsample...\n")
res <- fsvsample(sim$y, factors = factors, draws = iterations, burnin = 0,
keeptime = "all", quiet = TRUE, signident = FALSE)
# Do the draws in 'iterations' calls to fsvsample
cat("Drawing in many calls to fsvsample...\n")
res2 <- fsvsample(sim$y, factors = factors, draws = 1, burnin = 0,
keeptime = "all", quiet = TRUE, signident = FALSE,
# In principle, res and res2 should contain exactly the same (last) draws.
# Numerical differences may arise due to, e.g., rounding errors and their
# propagation when iterations is larger than a handful or so.
# Stochastically the results should be equivalent.
cat("Latest auxiliaries:", all.equal(res$latestauxiliary, res2$latestauxiliary), "\n")
cat("Latest (absolute) loadings:", all.equal(abs(res$facload[,,iterations]), abs(res2$facload[,,1])), "\n")
cat("Latest paras:", all.equal(res$para[,,iterations], res2$para[,,1]), "\n")
# If you are interested in speed, set iterations to a few hundred at least
cat("Absolute time difference:", tim2 - tim, "\n")
cat("Relative time difference:", (tim2 - tim) / tim, "\n")

"Drawing from the posterior in one as well as in multiple calls to fsvsample()"
"Drawing in many calls to fsvsample...\n"

Drawing from the posterior in one as well as in multiple calls to fsvsample()