tests/testthat/test-cran-final-regressions.R

test_that("tabmeta default plotting including funnel does not fail", {
  skip_if_not_installed("metafor")
  d <- utils::read.csv(system.file("extdata", "meta_example.csv",
                                   package = "R4VN"))
  expect_no_error({
    m <- tabmeta(
      data = d, study = study,
      event1 = event_treat, n1 = n_treat,
      event0 = event_control, n0 = n_control,
      or = TRUE, show = FALSE
    )
  })
  expect_s3_class(m, "r4vn_meta")
})

test_that("savedata can write Stata and SPSS with portable names", {
  skip_if_not_installed("haven")
  d <- data.frame(
    sepal_length = c(5.1, 4.9),
    species = c("setosa", "setosa"),
    stringsAsFactors = FALSE
  )
  f_dta <- tempfile(fileext = ".dta")
  f_sav <- tempfile(fileext = ".sav")
  on.exit(unlink(c(f_dta, f_sav)), add = TRUE)
  expect_no_error(savedata(d, f_dta, quiet = TRUE))
  expect_no_error(savedata(d, f_sav, quiet = TRUE))
  expect_true(file.exists(f_dta))
  expect_true(file.exists(f_sav))
})

Try the R4VN package in your browser

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

R4VN documentation built on Sept. 30, 2026, 5:13 p.m.