tests/testthat/test-stat_barrel_annotate.R

library(testthat)

test_that("stat_barrel_annotate adds annotation layer", {
  library(ggplot2)
  library(vegan)

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

  p <- ggplot(scores, aes(x = RDA1, y = RDA2)) +
    stat_barrel_annotate(ord = rda_mod)
  expect_s3_class(p, "ggplot")
})

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.