tests/testthat/test-datLUTnm.R

test_that("datLUTnm works as expected", {

  skip_on_cran()

  # Test Look up table classification with Disturbance Type
  ref_dstrbcd <- FIESTAutils::ref_codes[FIESTAutils::ref_codes$VARIABLE == "DSTRBCD",]

  testLUTnm <- datLUTnm(x = WYcond,
                        xvar = "DSTRBCD1",
                        LUT = ref_dstrbcd,
                        LUTvar = "VALUE",
                        LUTnewvar = "MEANING",
                        LUTnewvarnm = "DSTRB1NM")

  testLUTnm_results <- testLUTnm$xLUT

  # Gets Data where not N/A
  filtered_result <- testLUTnm_results[testLUTnm_results$DSTRBCD1 > 0, ]
  
  expect_equal(filtered_result[1]$DSTRB1NM, "Insect")
})

Try the FIESTA package in your browser

Any scripts or data that you put into this service are public.

FIESTA documentation built on June 22, 2024, 7:37 p.m.