Learn R Programming

RDataTracker (version 2.25.0)

Checkpoint: RDataTracker Checkpoint and Restore

Description

These functions work with RDataTracker to save and restore the R state and the file system state. They also record in the provenance graph where the checkpoints and restore occur and their effect on the data used. Note that these functions are not included in the RDataTracker library since they change the user's global environment when a restore is performed. To use these functions, you must download and source DDGCheckpoint.R.

Usage

ddg.checkpoint(checkpoint.name = NULL) ddg.restore(file.path)

Arguments

checkpoint.name
the value associated with the checkpoint procedure node.
file.path
the name of the checkpoint file to restore.

Value

ddg.checkpoint returns the full path to the file in which the checkpoint is saved. This value should be passed to any subsequent calls to ddg.restore that want to restore that particular checkpoint.

Details

ddg.checkpoint saves the current R state in a file and returns the path to the saved file. It adds a Checkpoint node and a Snapshot node to the provenance graph created by RDataTracker. The Snapshot node references the file that contains the saved state. ddg.restore can be called later by passing in the name of a checkpoint file. It will restore the state of the R workspace to the state of the checkpoint file. It will also revert any files that were saved by an earlier call to ddg.file or ddg.file.out to the state they were in at the time that the checkpoint was taken. ddg.restore also adds a Restore node to the provenance graph, with an input edge from the saved checkpoint file. The provenance graph will reflect the variable state following the restore.

Examples

Run this code
## Not run: source("DDGCheckpoint.R")
dir.create("ddg", showWarnings=FALSE)
ddg.init()
## Not run: checkpoint <- ddg.checkpoint()

## Not run: ddg.restore(checkpoint)
ddg.save()

Run the code above in your browser using DataLab