mat_join_compare: Compare if datasets are equal

mat_join_compareR Documentation

Compare if datasets are equal

Description

Merge, and for all identical variables, compare

Usage

mat_join_compare(
  df1,
  df2,
  by = NULL,
  join_fun = dplyr::inner_join,
  tol = 1e-08
)

Arguments

df1, df2

The two df to compare

by

the key variables

join_fun

the type of join

tol

tolerance value

Examples

library(dplyr)
data(iris_tb)
iris_orig <- mutate(iris_tb, row_num = 1:n())
iris_new <- mutate(iris_orig, Sepal.Length =Sepal.Length+0.000001)
mat_join_compare(df1=iris_orig, df2=iris_new, by = c("row_num", "Species"))
mat_join_compare(df1=iris_orig, df2=iris_new, by =c("row_num", "Species"), tol = 0.00001)
## compare identical but smaller subset with inner_join:
iris_smaller <- subset(iris_orig, Species!="setosa")
mat_join_compare(df1=iris_orig, df2=iris_smaller, by = c("row_num", "Species"),
                 join_fun = dplyr::full_join)

MatthieuStigler/matPkg documentation built on Sept. 19, 2024, 5:19 a.m.