tests/testthat/test-propr-parallel.R

library(propr)
library(parallel)

describe("updateCutoffs.propr()", {

  num_rows <- 5
  num_cols <- 10

  # Make count-like data
  counts <- rnbinom(num_rows * num_cols, size = 0.1, mu = 10) + 1
  dat <- matrix(counts, nrow = num_rows)

  pr <- propr(dat, "phs", p = 20)

  singleCoreResult <- updateCutoffs(pr, ncores = 1)
  multiCoreResult <- updateCutoffs(pr, ncores = 2)

  describe("with multiple cores", {
    it("matches the single core version of the function", {
      expect_equal(multiCoreResult@fdr, singleCoreResult@fdr)
    })
  })
})

Try the propr package in your browser

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

propr documentation built on Dec. 16, 2019, 9:30 a.m.