Crunch datasets include information about the dataset's revision history. This function takes the changes made on a dataset fork and adds them to the revision history of the parent dataset, like a merge of branches in a version control system.

mergeFork(dataset, fork, autorollback = TRUE, force = FALSE)

Arguments

dataset

The CrunchDataset to merge to

fork

The CrunchDataset, which must be a fork from dataset, that is to be merged in.

autorollback

logical If the merge fails, should dataset be restored to its state prior to the merge, or should it be left in its partially merged state for debugging and manual fixing? Default is TRUE.

force

logical Attempt to push through merge conflicts by dropping all changes to dataset that occurred after fork diverged from and take only the changes from fork? Default is FALSE. You should only use force=TRUE after first attempting and failing to merge without forcing.

Value

dataset with changes from fork merged to it.

Details

All modifications of a dataset record actions in its revision history. For example, if you add a variable to the dataset, that action is recorded. The sum of these records is a dataset's revision history, and it is possible to merge in the revision history of a dataset that has been forked.

This function is most often used in conjunction with forkDataset() to create a copy of a dataset, make some changes to that copy, and then merge the changes back into the original dataset. For more on this workflow, see vignette("fork-and-merge", package = "crunch").

See also

Examples

if (FALSE) {
ds <- loadDataset("My survey")
fork <- forkDataset(ds)
# Do stuff to fork
ds <- mergeFork(ds, fork)
# Now the changes you did to fork are also on ds
}