Conference Agenda

Overview and details of the sessions of this conference. Please select a date or location to show only sessions at that day or location. Please select a single session for detailed view (with abstracts and downloads if available).

 
 
Session Overview
Session
3C - R Packages 2
Time:
Tuesday, 06/July/2021:
8:45am - 10:15am

Session Chair: Maëlle Salmon
Zoom Host: Maryam Alizadeh
Replacement Zoom Host: Faith Musili
Location: The Lounge #talk_packages_2
Session Topics:
R in production, Efficient programming


Presentations
8:45am - 9:05am
Talk-Video
ID: 169 / ses-03-C: 1
Regular Talk
Topics: Efficient programming
Keywords: API

autotest: Automatic testing of R packages

Mark Padgham

rOpenSci

The 'autotest' package has been developed by rOpenSci to automatically test the robustness of R packages to unexpected inputs. We hope that its usage will enable and encourage software to reach the highest possible quality prior to our peer-review process. 'autotest' implements a form of mutation testing which identifies expected or permitted forms for each parameter, and examines how each function responds to mutations of those inputs. Many software bugs are uncovered by packages being used in ways that developers themselves may not have anticipated, yet no developer can anticipate all potential ways software may be used. 'autotest' eases the task of making software robust to "unexpected" usage by testing and reporting any points at which mutations to inputs generate unexpected results.

The package also matches expectations with textual descriptions provided by function documentation, and ensures that descriptions of input and output parameters are sufficient for users to understand ranges of admissible inputs, and of returned values. Application of 'autotest` to a package should thus ensure that forms and ranges of every parameter of every function are clearly described, and that all functions respond consistently to as many diverse forms of input as possible.

Finally, 'autotest' can also be used to automatically generate a package test suite. Although highly variable, applying the test to a package consisting primarily of numeric algorithms can "automatically" generate a test suite covering well over 50% of code.

Link to package or code repository.
https://github.com/ropenscilabs/autotest


9:05am - 9:25am
Talk-Video
ID: 111 / ses-03-C: 2
Regular Talk
Topics: Efficient programming
Keywords: algorithms

A fresh look at unit testing with tinytest

Mark van der Loo

Statistics Netherlands

"The tinytest package[1,2] implements a light weight and flexible framework for unit testing R packages. In spite of its young age, tinytest has become quite popular: since it was released on CRAN in the spring of 2019, more than 140 packages on CRAN and Bioconductor have started to use tinytest for automatic unit testing. This includes influential packages such as Rcpp.

Tinytest has a few unique features that set it apart from other testing frameworks, such as parallelization and tracking of side-effects. Side effects such as changes in environment variables are important, for example when working with locale-sensitive operations such as sorting, or date-time conversions. Tinytest also makes it easy to temporarily manipulate the testing environment during the run of the test. For example by changing environment

variables. In tinytest, test results are just another type of data. They can be easily translated to data frame layout which to investigate results, or export them from an automated build environment. Moreover, tests are installed with the package so package authors can ask their users to run tests on the user's infrastructure. Using tinytest is easy, as test scripts require no special code: tinytest automatically collects and organizes test results that are

created by any unit test expectation occurring in the script.

As the name suggests, tinytest is a small package, built in less than 1200 lines of code and no dependencies other than two R-base packages that come with any R installation.

[1] M van der Loo (2017). tinytest: R package version 1.2.4. https://cran.r-project.org/package=tinytest

[2] MPJ van der Loo (2020) A method for deriving information from running R code. R-Journal (Accepted) https://arxiv.org/abs/2002.07472

Link to package or code repository.
https://cran.r-project.org/package=tinytest


9:25am - 9:45am
Talk-Live
ID: 239 / ses-03-C: 3
Regular Talk
Topics: R in production
Keywords: R markdown

{fusen}: Create a package from Rmd files

Sébastien Rochette

ThinkR

You know how to build a Rmarkdown for reproducibility, you were said or would like to put your work in a R package, but you think this is too much work? You do not understand where to put what and when? What if writing a Rmd was the same as writing a package? Let {fusen} help you with this task.

When you write a Rmarkdown file (or a vignette), you create a documentation for your analysis (or package). Inside, you write some functions, you apply your functions to examples and you maybe write some unit tests to verify the outputs. This is even more true if you follow this guide : ['Rmd first': When development starts with documentation](https://rtask.thinkr.fr/blog/rmd-first-when-development-starts-with-documentation/).

Why not transforming this workflow into a documented, tested and maintainable R package to ensure sustainability of your analyses ? To do so, you will need to move your functions and scripts in the correct place. Let {fusen} do this transformation for you!

{fusen} is first addressed to people who never wrote a package before but know how to write a RMarkdown file. Understanding package infrastructure and correctly settling it can be frightening. This package may help them do the first step!

{fusen} is also addressed to more advanced developers who are fed up with switching between R files, tests files, vignettes. In particular, when changing arguments of a function, we need to change examples, unit tests in multiple places. Here, you can do it in one place. No risk to forget one. Package {fusen} is himself built with himself, from Rmd template files stored in the appropriate place