flowR: Program Slicing and Dependency Analysis to Improve the Reuse of R Scripts
A program slicer reduces a program to only the parts relevant to a certain variable of interest like a visualization or a statistical test. This way, a slice is usually a much smaller script that is easier to understand, has fewer dependencies, and focuses only on the analysis of interest.Such slices can be beneficial for both reviewers, trying to understand and validate the methodology, and authors wishing to reuse and reproduce existing analyses. Even if the original script is not executable due to missing dependencies, a slice that does not rely on them can be executed and reused independently.In our talk, we introduce flowR, a novel program slicer and dataflow analyzer for R, alongside its Visual Studio Code extension and RStudio addin which allow users to interactively slice their scripts directly from their IDE.To calculate slices and the dependency information, flowR uses a pipeline architecture that first parses the R code into an abstract syntax tree, which is subsequently normalized into a version-independent intermediate representation.Based on this representation, flowR uses an interprocedural dataflow analysis to construct a static dataflow graph of the entire script.This graph describes the dependencies of variables and function calls, compensating for the inherently dynamic nature of R.A program slice is essentially the subgraph that is reachable from the variable of interest. Besides slicing, we also provide a dependency view of the entire analysis script which shows the inputs, sourced files, required libraries, and produced outputs to help users find and understand the important parts and required inputs.Acknowledgements This work was supported by the German Research Foundation (DFG): 504226141A recording of this session is available on YouTube: https://youtu.be/6Ztme0Lxe-A
Institutions
- Max Planck Society (DE)
- Weatherford College (US)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2025-12-17
- DOI
- https://doi.org/10.5281/zenodo.17967401
- Primary Topic
- Software Testing and Debugging Techniques
- Type
- article
- Field-Weighted Citation Impact
- 0.00