On the Anatomy of Real-World R Code for Static Analysis

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Sihler, Florian, Pietzschmann, Lukas, Straub, Raphael, Tichy, Matthias, Diera, Andor, Dahou, Abdelhalim
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866913213938925568
author Sihler, Florian
Pietzschmann, Lukas
Straub, Raphael
Tichy, Matthias
Diera, Andor
Dahou, Abdelhalim
author_facet Sihler, Florian
Pietzschmann, Lukas
Straub, Raphael
Tichy, Matthias
Diera, Andor
Dahou, Abdelhalim
contents CONTEXT The R programming language has a huge and active community, especially in the area of statistical computing. Its interpreted nature allows for several interesting constructs, like the manipulation of functions at run-time, that hinder the static analysis of R programs. At the same time, there is a lack of existing research regarding how these features, or even the R language as a whole are used in practice. OBJECTIVE In this paper, we conduct a large-scale, static analysis of more than 50 million lines of real-world R programs and packages to identify their characteristics and the features that are actually used. Moreover, we compare the similarities and differences between the scripts of R users and the implementations of package authors. We provide insights for static analysis tools like the lintr package as well as potential interpreter optimizations and uncover areas for future research. METHOD We analyze 4230 R scripts submitted alongside publications and the sources of 19450 CRAN packages for over 350000 R files, collecting and summarizing quantitative information for features of interest. RESULTS We find a high frequency of name-based indexing operations, assignments, and loops, but a low frequency for most of R's reflective functions. Furthermore, we find neither testing functions nor many calls to R's foreign function interface (FFI) in the publication submissions. CONCLUSION R scripts and package sources differ, for example, in their size, the way they include other packages, and their usage of R's reflective capabilities. We provide features that are used frequently and should be prioritized by static analysis tools, like operator assignments, function calls, and certain reflective functions like load.
format Preprint
id arxiv_https___arxiv_org_abs_2401_16228
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle On the Anatomy of Real-World R Code for Static Analysis
Sihler, Florian
Pietzschmann, Lukas
Straub, Raphael
Tichy, Matthias
Diera, Andor
Dahou, Abdelhalim
Programming Languages
Software Engineering
CONTEXT The R programming language has a huge and active community, especially in the area of statistical computing. Its interpreted nature allows for several interesting constructs, like the manipulation of functions at run-time, that hinder the static analysis of R programs. At the same time, there is a lack of existing research regarding how these features, or even the R language as a whole are used in practice. OBJECTIVE In this paper, we conduct a large-scale, static analysis of more than 50 million lines of real-world R programs and packages to identify their characteristics and the features that are actually used. Moreover, we compare the similarities and differences between the scripts of R users and the implementations of package authors. We provide insights for static analysis tools like the lintr package as well as potential interpreter optimizations and uncover areas for future research. METHOD We analyze 4230 R scripts submitted alongside publications and the sources of 19450 CRAN packages for over 350000 R files, collecting and summarizing quantitative information for features of interest. RESULTS We find a high frequency of name-based indexing operations, assignments, and loops, but a low frequency for most of R's reflective functions. Furthermore, we find neither testing functions nor many calls to R's foreign function interface (FFI) in the publication submissions. CONCLUSION R scripts and package sources differ, for example, in their size, the way they include other packages, and their usage of R's reflective capabilities. We provide features that are used frequently and should be prioritized by static analysis tools, like operator assignments, function calls, and certain reflective functions like load.
title On the Anatomy of Real-World R Code for Static Analysis
topic Programming Languages
Software Engineering
url https://arxiv.org/abs/2401.16228