merge_data: Merge two tables based on a parent version

View source: R/merge-data.R

merge_dataR Documentation

Merge two tables based on a parent version

Description

merge_data provides a three-way merge: suppose two versions are based on a common version, this function will merge tables a and b.

Usage

merge_data(parent, a, b)

Arguments

parent

data.frame

a

data.frame changed version of parent

b

data.frame other changed version of parent

Details

If both a and b change the same table cell with a different value, this results in a conflict. In that case a warning will be generated with the number of conflicts. In the returned data.frame of a conflicting merge columns with conflicting values are of type character and contain all three values coded as

(parent) a /// b

Value

merged data.frame. When a merge has conflicts the columns of conflicting changes are of type character and contain all three values.

See Also

which_conflicts

Examples

parent <- a <- b <- iris[1:3,]
a[1,1] <- 10
b[2,1] <- 11
# succesful merge
merge_data(parent, a, b)

parent <- a <- b <- iris[1:3,]
a[1,1] <- 10
b[1,1] <- 11
# conflicting merge (both a and b change same cell)
merged <- merge_data(parent, a, b)
merged #note the conflict

#find out which rows contain a conflict
which_conflicts(merged)

daff documentation built on June 22, 2024, 12:26 p.m.