Learn R Programming

utils (version 3.4.1)

removeSource: Remove Stored Source from a Function.

Description

When options("keep.source") is TRUE, a copy of the original source code to a function is stored with it. This function removes that copy.

Usage

removeSource(fn)

Arguments

fn

A single function from which to remove the source.

Value

A copy of the function with the source removed.

Details

This removes the "srcref" and related attributes.

See Also

srcref for a description of source reference records, deparse for a description of how functions are deparsed.

Examples

Run this code
fn <- function(x) {
  x + 1 # A comment, kept as part of the source
}
fn
fn <- removeSource(fn)
fn

Run the code above in your browser using DataLab