R-Package “plnr” (version 2022.6.8) Published on CRAN

“plnr” is a system to plan analyses within the mental model where you have one (or more) datasets and want to run either A) the same function multiple times with different arguments, or B) multiple functions. This is appropriate when you have multiple strata (e.g. locations, age groups) that you want to apply the same function to, or you have multiple variables (e.g. exposures) that you want to apply the same statistical method to, or when you are creating the output for a report and you need multiple different tables or graphs.


Changes since last version

The R-package “plnr” (version 2022.6.8) has been published on CRAN. “plnr” is a part of the splverse, a set of R packages developed to help solve problems that frequently occur when performing infectious disease surveillance. “plnr” has two vignettes that briefly show the mental model behind “plnr”:


Broad technical terms
Object Description
argset A named list containing a set of arguments.

These are the fundamental units that are scheduled in plnr:

  • 1 argset
  • 1 (action) function that takes two arguments
    1. data (named list)
    2. argset (named list)

This is the overarching “scheduler”:

  • 1 data pull
  • 1 list of analyses
Different types of plans
Plan Type Description
Single-function plan Same action function applied multiple times with different argsets applied to the same datasets.
Multi-function plan Different action functions applied to the same datasets.
Plan Examples
Plan Type Example
Single-function plan Multiple strata (e.g. locations, age groups) that you need to apply the same function to to (e.g. outbreak detection, trend detection, graphing).
Single-function plan Multiple variables (e.g. multiple outcomes, multiple exposures) that you need to apply the same statistical methods to (e.g. regression models, correlation plots).
Multi-function plan Creating the output for a report (e.g. multiple different tables and graphs).

In brief, we work within the mental model where we have one (or more) datasets and we want to run multiple analyses on these datasets. These multiple analyses can take the form of:

By demanding that all analyses use the same data sources we can:

  1. Be efficient with requiring the minimal amount of data-pulling (this only happens once at the start).
  2. Better enforce the concept that data-cleaning and analysis should be completely separate.

By demanding that all analysis functions only use two arguments (data and argset) we can:

  1. Reduce mental fatigue by working within the same mental model for each analysis.
  2. Make it easier for analyses to be exchanged with each other and iterated on.
  3. Easily schedule the running of each analysis.

By including all of this in one Plan class, we can easily maintain a good overview of all the analyses (i.e. outputs) that need to be run.


If you see mistakes or want to suggest changes, please create an issue on the source repository.


Text and figures are licensed under Creative Commons Attribution CC BY 4.0. Source code is available at https://github.com/sykdomspulsen-org/sykdomspulsen-org.github.io, unless otherwise noted. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".


For attribution, please cite this work as

White (2022, June 8). Sykdomspulsen: R-Package "plnr" (version 2022.6.8) Published on CRAN. Retrieved from https://docs.sykdomspulsen.no/posts/2022-06-08-plnr-version-2022-6-8-published-on-cran/

BibTeX citation

  author = {White, Richard Aubrey},
  title = {Sykdomspulsen: R-Package "plnr" (version 2022.6.8) Published on CRAN},
  url = {https://docs.sykdomspulsen.no/posts/2022-06-08-plnr-version-2022-6-8-published-on-cran/},
  year = {2022}