tests/testthat/test-stat_barrel_arrows.R

library(testthat)

test_that("stat_barrel_arrows creates arrow layers", {
  library(ggplot2)
  library(vegan)
  library(ggrepel)

  data(dune)
  data(dune.env)
  rda_mod <- rda(dune ~ A1 + Moisture, data = dune.env)
  scores <- as.data.frame(vegan::scores(rda_mod, display = "sites"))

  layers <- stat_barrel_arrows(ord = rda_mod, matrix = dune.env, labels = TRUE)
  expect_true(is.list(layers))
  expect_true(all(vapply(layers, function(x) inherits(x, "LayerInstance"), logical(1))))
})

Try the barrel package in your browser

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

barrel documentation built on Nov. 5, 2025, 7:40 p.m.