tests/testthat/test_coordinates.R

library("testthat")
library("neotoma2")

context("`coordinates()` function")
testthat::test_that("coordinates() returns correct coordinates", {
  skip_on_cran()
  sts <- get_sites(c(101, 102))
  sts_df <- as.data.frame(sts)
  coords <- coordinates(sts)
  testthat::expect_is(coords, "data.frame")
  testthat::expect_equal(nrow(coords), 2)
  testthat::expect_equal(ncol(coords), 3)
  testthat::expect_equal(coords$siteid, sts_df$siteid)
  testthat::expect_equal(coords$latitude, sts_df$latitude, tolerance = 0.01)
  testthat::expect_equal(coords$longitude, sts_df$longitude, tolerance = 0.01)
})

Try the neotoma2 package in your browser

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

neotoma2 documentation built on Dec. 6, 2025, 5:07 p.m.