duncantl/CodeAnalysis: Tools for Static Analysis of R code

This package provides a (growing) collection of functions that analyze R code and identify particular idioms or characteristics. Some of these functions modify the code to produce more streamlined version. The package is motivated by compilation of R code and simplifying code ahead of compilation. However, the functionality may be useful generally for improving R code and diagnosing issues, and also in other contexts such as dynamic documents. We will continue to add functionality to analyze code for different purposes, e.g. memory management, opportunities for parallelism, data locality for parallel computations, ... Currently, there is functionality to: * find unused parameters/arguments * find unused variables/assignments * identify constant parameters (i.e. unchanged in the function's body) * detect vector concatenation in loops * identify & remove dead code (after a call to return()) * remove dead if/else code blocks (i.e. where we are certain the condition is TRUE or FALSE) * identify parallel for loops.

Getting started

Package details

AuthorDuncan Temple Lang, Nick Ulle, Clark Fitzgerald, Matt Espe
MaintainerDuncan Temple Lang <duncan@r-project.org>
LicenseBSD_3_clause + file LICENSE
Version0.4-0
Package repositoryView on GitHub
Installation Install the latest version of this package by entering the following in R:
install.packages("remotes")
remotes::install_github("duncantl/CodeAnalysis")
duncantl/CodeAnalysis documentation built on Feb. 21, 2024, 10:49 p.m.