tests/testthat/test-get_SDA_pmgroupname.R

test_that("get_SDA_pmgroupname works", {
  skip_if_offline()

  skip_on_cran()
  
  res <- get_SDA_pmgroupname(areasymbols = c("CA077", "CA630"))
  skip_if(is.null(res))
  expect_equal(nrow(res), length(unique(res$mukey)))
  
  # some misc areas have geomorph populated (e.g. "Mixed alluvial land", but others, like "Water" are NULL)
  res <- get_SDA_pmgroupname(mukeys = c(462409, 2462630), simplify = FALSE, method = "dominant condition") # default is miscellaneous_areas=FALSE
  expect_null(res)
  
  res <- get_SDA_pmgroupname(mukeys = c(462409, 2462630), simplify = FALSE, miscellaneous_areas = TRUE, method = "dominant condition")
  skip_if(is.null(res))
  expect_equal(nrow(res), 2)
  
  res <- get_SDA_pmgroupname(mukeys = c(461994, 461995), simplify = FALSE, method = "none")
  skip_if(is.null(res))
  expect_equal(nrow(res), 7)  
  
  res <- get_SDA_pmgroupname(mukeys = c(461994, 461995), simplify = FALSE, method = "none", miscellaneous_areas = TRUE)
  skip_if(is.null(res))
  expect_equal(nrow(res), 11)
  
  res <- get_SDA_pmgroupname(mukeys = c(461994, 461995), simplify = FALSE, method = "dominant condition")
  skip_if(is.null(res))
  expect_equal(nrow(res), 2)
})

Try the soilDB package in your browser

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

soilDB documentation built on June 22, 2024, 9:53 a.m.