Is there a compare function in R to compare 2 data sets , like we have proc compare in SAS and it gives the full summary of matches and mismatches , I am using library(arsenal) and using comparedf , it does gives the summary but I was wondering is there any thing more appropriate .
If the datasets are similar enough, waldo::compare()
may also be useful:
x <- data.frame(a = 1:5)
y <- x
y$a[2] <- 12.0
waldo::compare(x, y)
#> old vs new
#> a
#> old[1, ] 1
#> - old[2, ] 2
#> + new[2, ] 12
#> old[3, ] 3
#> old[4, ] 4
#> old[5, ] 5
#>
#> `old$a` is an integer vector (1, 2, 3, 4, 5)
#> `new$a` is a double vector (1, 12, 3, 4, 5)
(the console output also has some color)
If you use the tidyverse, chances are the {waldo}
package is already installed on your system.
1 Like
Thank you this looks good