tests/testthat/test-neighbors.R

test_that("neighbors works", {
  # example
  # x:               1, 2, 3, 4
  # left neighbors:  4, 1, 2, 3
  # right neighbors: 2, 3, 4, 1
  #
  # neighbors combined in correct order:
  # neighbors: 4, 2, 1, 3, 2, 4, 3, 1

  expect_equal(
    neighbors(seq_len(4)),
    c(4, 2, 1, 3, 2, 4, 3, 1)
  )
})

Try the ggpointless package in your browser

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

ggpointless documentation built on May 29, 2024, 7:16 a.m.