ihmeuw-demographics / demUtils

Utility functions for working with demographic data and estimates.
https://ihmeuw-demographics.github.io/demUtils
BSD 3-Clause "New" or "Revised" License
0 stars 2 forks source link

Table Comparison Tool #18

Open meghanfrisch opened 3 years ago

meghanfrisch commented 3 years ago

Create a function to compare a Lancet pdf table to our submitted table. Used to check for Lancet publication typos without the team manually checking and comparing each value

krpaulson commented 3 years ago

Can copy Lancet PDF into a csv, upload two csvs into R, then do something like this:

# create two slightly different dataframes
dt1 <- data.frame(
  x = c(1:4),
  y = c("a", "b", "c", "d")
)
dt2 <- dt1
dt2$y <- c("a", "b", "j", "k")

# view
print(dt1)
#>   x y
#> 1 1 a
#> 2 2 b
#> 3 3 c
#> 4 4 d
print(dt2)
#>   x y
#> 1 1 a
#> 2 2 b
#> 3 3 j
#> 4 4 k

# compare
dplyr::anti_join(dt1, dt2)
#> Joining, by = c("x", "y")
#>   x y
#> 1 3 c
#> 2 4 d

Does that seem feasible?

Created on 2021-07-16 by the reprex package (v2.0.0)

chacalle commented 3 years ago

@hcomfo95 do you know why this would need a separate function?

I've also found waldo::compare useful for quick comparisons as well https://waldo.r-lib.org/

hcomfo95 commented 3 years ago

I think using a function that already exists is fine. The main goal was just to have a quick way to compare the Lancet table to ours instead of having to check each value manually.