tests/testthat/test_region_matrix_to_ids.R

library(RcppCWB)

testthat::context("region_matrix_to_ids")

test_that(
  "regions_to_ids",
  {
    ids <- region_matrix_to_ids(
      corpus = "REUTERS",
      p_attribute = "word",
      registry = system.file(package = "RcppCWB", "extdata", "cwb", "registry"),
      matrix = matrix(c(0, 91), nrow = 1)
    )
    expect_equal(tail(ids, n = 6L), c(55L, 56L, 41L, 15L, 57L, 58L))
  }
)

Try the RcppCWB package in your browser

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

RcppCWB documentation built on Oct. 22, 2018, 5:08 p.m.