Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
It’s been yet-another weirdly busy summer but I’m finally catching up on noting some recent-ish developments in the blog.
First up is a full rewrite of the {wand} pacakge which still uses magic but is 100% R code (vs a mix of compiled C and R code) and now works on Windows. A newer version will be up on CRAN in a bit that has additional MIME mappings and enables specifying a custom extension mapping data frame. You’ve seen this beast on the blog before, though, by another name.
wand::get_content_type("/etc/syslog.conf") ## [1] "text/plain"
Next is the {ulid} package (which I’ve also previously discussed, here) which is also now on CRAN to meet all your Universally Unique Lexicographically Sortable Identifiers-generation needs.
ulid::ulid_generate() ## [1] "0001EKRGTCRSVA4ACSCQJA61A0" ulid::unmarshal("0001EKRGTCRSVA4ACSCQJA61A0") ## ts rnd ## 1 2019-07-27 08:27:56 RSVA4ACSCQJA61A0
The [{testthat}] gravity well has caught over 4,000 CRAN packages but it’s not the only testing game in town. The {tinytest} package take slightly more minimalist approach and has the added benefit that the tests come along for the ride with the package, which makes it easier to solicit said test results from package users having problems with your code.
I still use {testthat} in most of my packages but gave {tinytest} a spin for a few of my more recent ones and it’s pretty nifty. The biggest feature I missed when switching to it was the lack of Cmd-Shift-T support for it in RStudio. Since I kinda still want Cmd-Shift-T for all the packages I have that use {testthat} I whipped up an RStudio addin that adds an Addin context menu item (below) and placed it in {hrbraddins}.
If you load up that package you can then bind something like Cmd-Option-Shift-T to that function and have equally quick keystroke access to package tests during development.
> hrbraddins:::run_tiny_test() # from within the {wand} pkg Running test_wand.R................... 52 tests OK All ok (52 results)
Finally, I got bit in a recent CRAN submission because I have remote CRAN checks turned off (soooo sloooowww) but had a 404’ing URL in the documentation of one of the methods in the package. Since I have a few more submissions coming up in the next 6-8 weeks I decided to whip up an RStudio addin for an on-the-fly package URL checker that wraps the exact same checks CRAN does for these submissions. (I keybound this to Cmd-Option-Shift-U and you can catch a glimpse of it in the addins menu in the above screenshot).
The output of one run is below. I deliberately modified two working URLs to show what you get output-wise when everything isn’t perfect:
> hrbraddins:::check_package_urls() Gathering URLs for {wand} (this may take a bit) - Looking in HTML files... - Looking in metadata files... - Looking in news files... - Looking in Rd files... - Looking in README files... - Looking in source files... - Looking in PDF files... Checking found URLs (this may also take a bit) # A tibble: 13 x 4 url parent status is_https <chr> <chr> <dbl> <lgl> 1 https://gitlab.com/hrbrmstr/wand/issuessss DESCRIPTION 599 TRUE 2 http://gitlab.com/hrbrmstr/wand DESCRIPTION 200 FALSE 3 https://github.com/jshttp/mime-db man/wand.Rd 200 TRUE 4 https://github.com/threatstack/libmagic/tree/master/magic/ man/wand.Rd 200 TRUE 5 https://ci.appveyor.com/project/hrbrmstr/wand README.md 200 TRUE 6 https://codecov.io/gh/hrbrmstr/wand README.md 200 TRUE 7 https://cranchecks.info/pkgs/wand README.md 200 TRUE 8 https://github.com/r-lib/remotes README.md 200 TRUE 9 https://github.com/threatstack/libmagic/tree/master/magic/ README.md 200 TRUE 10 https://keybase.io/hrbrmstr README.md 200 TRUE 11 https://travis-ci.org/hrbrmstr/wand README.md 200 TRUE 12 https://www.r-pkg.org/pkg/wand README.md 200 TRUE 13 https://www.repostatus.org/#active README.md 200 TRUE
The {hrbraddins} package itself is just a playground and will never see CRAN, so do not hesitate to yank anything from it and put it in a safer and/or more accessible location for your own work.
FIN
For the packages, file issues and PRs the same way you always would. Same goes for the addins.
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.