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

track_copy

Track if an object is copied


Description

The title is somewhat misleading: rather than checking if an object is modified, this really checks to see if a name points to the same object.

Usage

track_copy(var, env = parent.frame(), quiet = FALSE)

Arguments

var

variable name (unquoted)

env

environment name in which to track changes

quiet

if FALSE, prints a message on change; if FALSE only the return value of the function is used

Value

a zero-arg function, that when called returns a boolean indicating if the object has changed since the last time this function was called

Examples

a <- 1:5
track_a <- track_copy(a)
track_a()
a[3] <- 3L
track_a()
a[3] <- 3
track_a()
rm(a)
track_a()

pryr

Tools for Computing on the Language

v0.1.4
GPL-2
Authors
Hadley Wickham [aut, cre], R Core team [ctb] (Some code extracted from base R)
Initial release

We don't support your browser anymore

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