tests/testthat/test.angle.R

context("angle")
test_that("angle", {
  expect_equal(angle(move(rep(0, 10), 0:9, Sys.time() + 1:10, proj = CRS("+proj=longlat"))), rep(0, 9))
  expect_equal(angle(move(0:9, rep(0, 10), Sys.time() + 1:10, proj = CRS("+proj=longlat"))), rep(90, 9))
  expect_equal(angle(move(9:0, rep(0, 10), Sys.time() + 1:10, proj = CRS("+proj=longlat"))), rep(-90, 9))
  expect_equal(angle(move(9:0, rep(0, 10), Sys.time() + 1:10, proj = CRS("+proj=longlat"), animal = gl(2, 5))), list(X1 = rep(-90, 4), X2 = rep(-90, 4)))
})

Try the move package in your browser

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

move documentation built on July 9, 2023, 6:09 p.m.