File: test-quantile_sparse.R

package info (click to toggle)
r-bioc-sparsematrixstats 1.2.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,052 kB
  • sloc: cpp: 1,332; makefile: 2
file content (12 lines) | stat: -rw-r--r-- 330 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
test_that("quantile_sparse method works", {
  for(i in 1:100){
    N <- rpois(1, lambda=2)
    vec <- rnorm(N)
    nz <- rpois(1, lambda=3)
    compl_vec <- sort(c(vec, rep(0, nz)))
    prob <- runif(1)
    q1 <- quantile(compl_vec, prob)
    q2 <- quantile_sparse(vec, nz, prob)
    testthat::expect_equal(unname(q1), q2)
  }
})