tests/testthat/test_id2freq.R

library(RcppCWB)

testthat::context("cl_id2freq")

test_that(
  "id2freq",
  {
    N <- cl_id2freq(
      corpus = "REUTERS",
      p_attribute = "word",
      id = 15,
      registry = get_tmp_registry()
    )
    expect_equal(N, 78L)
  }
)

test_that(
  "id_to_freq",
  {
    old <- cl_id2freq(
      corpus = "REUTERS",
      p_attribute = "word",
      id = 15,
      registry = get_tmp_registry()
    )
    
    p <- p_attr(corpus = "REUTERS", p_attribute = "word", registry = get_tmp_registry())
    new <- id_to_freq(id = 15L, p_attr = p)
    expect_identical(old, new)
  }
)

Try the RcppCWB package in your browser

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

RcppCWB documentation built on July 9, 2023, 7:40 p.m.