break.point: Sets a break point that can be debugged like a restore point

Description Usage Arguments Details

View source: R/restorepoint.R

Description

This function can be used as an alternative to browser(). When called inside a function, break.point stores all local objects and then does the following. i) If to global=FALSE (the default for break.point) starts the restore.point.browser for the local objects. ii) if to.global=TRUE copies the local objects to the global environment and stops execution.

Usage

1
2
3
4
break.point(name = "BREAK_POINT___",
  to.global = get.restore.point.options()$break.point.to.global,
  deep.copy = get.restore.point.options()$deep.copy, force = FALSE,
  dots = eval(substitute(list(...), env = parent.frame())))

Arguments

name

key under which the objects are stored. For restore points at the beginning of a function, I would suggest the name of that function.

to.global

if TRUE (default) objects are restored by simply copying them into the global environment. If FALSE a new environment will be created and the restore point browser will be invoked.

deep.copy

if TRUE try to make deep copies of objects that are by default copied by reference. Works so far for environments (recursivly). The function will search lists whether they contain reference objects, but for reasons of speed not yet in other containers. E.g. if an evironment is stored in a data.frame, only a shallow copy will be made. Setting deep.copy = FALSE (DEFAULT) may be useful if storing takes very long and variables that are copied by reference are not used or not modified.

force

store even if set.storing(FALSE) has been called

dots

by default a list of the ... argument of the function in whicht restore.point was called

Details

An alternative to break points are restore points. In the tutorial on GitHub, I provide some arguments how restore points can facilitate debugging compared to break points.


skranz/restorepoint documentation built on March 21, 2021, 3:35 a.m.