tests/testthat/test_column_based_recode.R

test_that(desc = "Test column based recoding",
          
          code = {
            skip_on_oldrel()
            pairwise_na <-
              head(
                column_based_recode(
                  airquality,
                  criterion = "all_na",
                  values_from = "Temp",
                  values_to = "Test",
                  value = 420,
                  pattern_type = "contains",
                  pattern = "Solar.R|Ozone"
                )
              )
            pairwise_na_inplace <-
              head(
                column_based_recode(
                  airquality,
                  criterion = "all_na",
                  values_from = "Temp",
                  value = 420,
                  pattern_type = "contains",
                  pattern = "Solar.R|Ozone"
                )
              )
            expect_equal(pairwise_na[5, 7], 420)
            expect_true("Test" %in% names(pairwise_na))
            # same name
            expect_equal(pairwise_na_inplace[5, 4], 420)
            
            
          })

Try the mde package in your browser

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

mde documentation built on Feb. 10, 2022, 5:08 p.m.