Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
lubridate
underscores the problems of dependency hell.
Tinyverse
Recently, I found excellent articulation of this concept at the tinyverse for R. This view is espoused by two developers whom I particularly attempt to emulate: Matt Dowle of data.table and Dirk Eddelbuettel of the Rcpp family of packages. I highly recommend reading some of those essays. While reading myself, I remembered tinytest. I want to make crystal clear that I have no issue with testthat. It is a great package, and it does exactly what it purports to do. However, I want to be more proactive in doing my part to reduce dependencies for my end users, so I switched.
The Switch
It was easier than I expected! The main expect_
ations are all there. Converting testthat scripts was as simple as replacing test_that({"
with a comment hash and erasing the ending "})
. For expact_match
, I used expect_true
using any
and grepl
. For expect_length
, I used expect_identical
on the length of the string. That was it! I converted a few hundred tests in a matter of an hour or so. Programming to reduce dependency hell is not only worth it, but with intelligent packages like tinytest, easier than you may expect! I should probably add this to my list of R tips. As always, comments and suggestions are welcomed!
The post Reduce Dependency Hell: from testthat to tinytest appeared first on Strange Attractors.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.