mat_join_compare: Compare if datasets are equal

Description Usage Arguments Examples

Description

Merge, and for all identical variables, compare

Usage

1
2
3
4
5
6
7
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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::inner_join)

MatthieuStigler/matPkg documentation built on Aug. 10, 2021, 11:01 a.m.