HughParsonage / grattan

Common quantitative tasks for Australian policy analysts
25 stars 8 forks source link

`excl_vars` may be ignored in project #172

Closed HughParsonage closed 5 years ago

HughParsonage commented 5 years ago

This test should succeed:

test_that("excl_vars has priority", {
  skip_if_not_installed("taxstats")
  library(data.table)
  library(taxstats)
  s1718 <- project(sample_file_1314, h = 4L)
  s1718_noSwAmt <- project(sample_file_1314, h = 4L, excl_vars = "Sw_amt")
  Sw_all_equal <- function(DT1, DT2) {
    v1 <- .subset2(DT1, "Sw_amt")
    v2 <- .subset2(DT2, "Sw_amt")
    for (i in seq_along(v1)) {
      if (v1[i] != v2[i]) {
        return(FALSE)
      }
    }
    TRUE
  }

  expect_false(Sw_all_equal(s1718, s1718_noSwAmt))
})