tests/testthat/test_convertAncestry.R

#' Copyright(c) 2017-2024 R. Mark Sharp
#' This file is part of nprcgenekeepr
context("convertAncestry")

original <- c("china", "india", "hybridized", NA, "human", "gorilla")
ancestry <- convertAncestry(original)
test_that("convertAncestry makes correct transformations", {
  expect_true(is.factor(ancestry))
  ancestry <- as.character(ancestry)
  expect_equal(ancestry[1L], "CHINESE")
  expect_equal(ancestry[2L], "INDIAN")
  expect_equal(ancestry[3L], "HYBRID")
  expect_equal(ancestry[4L], "UNKNOWN")
  expect_equal(ancestry[5L], "OTHER")
  expect_equal(ancestry[6L], "OTHER")
})

Try the nprcgenekeepr package in your browser

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

nprcgenekeepr documentation built on June 8, 2025, 10:55 a.m.