tests/testthat/test_transform.R

## Some tests of transform()

options(warn=999)
test_that("Function transform() behaves itself", {
    expect_true(TRUE)

    foo <- function(x,M){  # checks that transform(transform(x,M),solve(M)) == x
        xt <- transform(transform(x,M),solve(M))
        discrepancy <- x %>% transform(M) %>% transform(solve(M)) - x
        expect_true(issmall(discrepancy),info=list(x,M))
    } # foo() closes

    for(i in 1:3){
        o <-  rform(terms=3,k=2,n=5,coeffs=rnorm(3))
        M <- matrix(rnorm(25),5,5)
        foo(o,M)
        
    }
})

Try the wedge package in your browser

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

wedge documentation built on Sept. 4, 2019, 9:02 a.m.