Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

zap_srcref

Zap source references


Description

There are a number of situations where R creates source references:

  • Reading R code from a file with source() and parse() might save source references inside calls to function and {.

  • sys.call() includes a source reference if possible.

  • Creating a closure stores the source reference from the call to function, if any.

These source references take up space and might cause a number of issues. zap_srcref() recursively walks through expressions and functions to remove all source references.

Usage

zap_srcref(x)

Arguments

x

An R object. Functions and calls are walked recursively.


rlang

Functions for Base Types and Core R and 'Tidyverse' Features

v0.4.11
MIT + file LICENSE
Authors
Lionel Henry [aut, cre], Hadley Wickham [aut], mikefc [cph] (Hash implementation based on Mike's xxhashlite), Yann Collet [cph] (Author of the embedded xxHash library), RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.