tests/testthat/test-lexops.R

context("lexopsdata::lexops dataset")

# lexops dataset ----
testthat::test_that("lexopsdata::lexops", {
  # only run the tests if the lexopsdata package is installed
  testthat::skip_if_not_installed("lexopsdata")
  # can call lexops and it is dataframe
  testthat::expect_true(is.data.frame(lexops))
  # has the expected number of rows
  testthat::expect_true(nrow(lexops)==262532)
  # can run a generate pipeline on the dataframe
  testthat::expect_equal(
    lexops |>
      dplyr::filter(PK.Brysbaert >= .75) |>
      split_by(BG.SUBTLEX_UK, 0.001:0.003 ~ 0.009:0.011) |>
      control_for(Zipf.SUBTLEX_UK, -0.2:0.2) |>
      control_for(Length, 0:0) |>
      generate(n = 500, match_null = "balanced", silent = TRUE) |>
      nrow(),
    500
  )
})

Try the LexOPS package in your browser

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

LexOPS documentation built on Dec. 1, 2026, 5:06 p.m.