tests/testthat/test-testthat.R

library(testthat)
context("checking the marr package")

library(marr)

test_that("checking dimensions of Marr object", {
        n_features <- 1200
        n_samples <- 20
        set.seed(3456)
        data_test <- matrix(rnorm(n_features * n_samples),
        n_features, n_samples)
        Marr_test <- Marr(object = data_test)

        expect_equal(length(MarrSamplepairs(Marr_test)),
        choose(n_samples,2))
        expect_equal(length(MarrFeatures(Marr_test)), n_features)
})

test_that("checking Marr data", {
        n_features <- 1200
        n_samples <- 20
        set.seed(3456)
        data_test <- matrix(rnorm(n_features * n_samples),
        n_features, n_samples)
        Marr_test <- Marr(object = data_test)

        expect_equal(MarrSamplepairs(Marr_test)[184], 0.08333333,
        tolerance = 1e-06)
        expect_equal(MarrFeatures(Marr_test)[879], 0.5263158,
        tolerance = 1e-06)
})

Try the marr package in your browser

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

marr documentation built on March 10, 2021, 2 a.m.