test_that("HW_3con works", {
tmax <- dTmax[[2]]
# print(tmax)
b_kong = HW_3con_rcpp(tmax, TRS_high = 25, TRS_low = 20, mink=3)
b_song_dt = HW_3con(tmax, TRS_high = 25, TRS_low = 20, mink = 3)
b_song_map = HW_3con(tmax, TRS_high = 25, TRS_low = 20, mink = 3, method = "map")
expect_true(all.equal(b_kong, b_song_dt))
expect_true(all.equal(b_song_dt, b_song_map))
# # 4-5 times faster
# microbenchmark::microbenchmark(
# b_kong = HW_3con_rcpp(tmax, TRS_high = 25, TRS_low = 20, mink=3),
# b_song = HW_3con(tmax, TRS_high = 25, TRS_low = 20, mink = 3)
# )
# microbenchmark::microbenchmark(
# # rle_bool(tmax >= 24),
# r = rle(tmax >= 24),
# r_std = rle_std(tmax >= 24)
# )
time = rbenchmark::benchmark(
b_kong = HW_3con_rcpp(tmax, TRS_high = 25, TRS_low = 20, mink=3),
b_song_dt = HW_3con(tmax, TRS_high = 25, TRS_low = 20, mink = 3),
b_song_map = HW_3con(tmax, TRS_high = 25, TRS_low = 20, mink = 3, method = "map"),
replications = 100
)
print(time)
# rle(b_kong)
# rle(b_song)
r_kong = rle_true(b_kong)[c("ibegin", "iend")]
r_song = rle_true(b_song_dt)[c("ibegin", "iend")]
expect_true(all.equal(r_kong, r_song))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.