Skip to content

Commit

Permalink
Merge d6b985f into d4ae656
Browse files Browse the repository at this point in the history
  • Loading branch information
AEBilgrau committed Apr 23, 2019
2 parents d4ae656 + d6b985f commit 3321bac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/is.theta.R
Expand Up @@ -78,7 +78,7 @@ is.theta <- function(theta, check.class = TRUE) {
theta[[2]], " times ", theta[[2]], " as given by theta[[2]].")
return(FALSE)
}
if (!all(sapply(theta[[5]], isSymmetric))) {
if (!all(sapply(theta[[5]], isSymmetric, check.attributes = FALSE))) {
warning("Not all covariance matrices are symmetric.")
return(FALSE)
}
Expand Down
10 changes: 10 additions & 0 deletions tests/testthat/test-is.theta-rtheta.R
Expand Up @@ -35,6 +35,13 @@ theta11[[5]] <- theta11[[5]][-1] # Improper number of sigmas
theta12 <- rtheta(d = 4, m = 3)
theta12[[5]] <- lapply(theta12[[5]], function(x) x[-1,-1]) # Improper dimension of sigmas

# Construct theta with sigma rownames only, colnames only, both, and no dimnames
theta13 <- rtheta(d = 5, m = 4)
dnames <- paste("dim", 1:5)
rownames(theta13$sigma$comp1) <- dnames
colnames(theta13$sigma$comp2) <- dnames
rownames(theta13$sigma$comp3) <- colnames(theta13$sigma$comp3) <- dnames

test_that("rtheta returns proper formatted output (old method)", {
expect_that(is.logical(is.theta(theta1)), is_true())
expect_that(length(is.theta(theta1)), equals(1))
Expand All @@ -52,6 +59,8 @@ test_that("rtheta returns proper formatted output (old method)", {
expect_false(is.theta(theta10))
expect_false(is.theta(theta11))
expect_false(is.theta(theta12))

expect_true(is.theta(theta13))
})
})

Expand Down Expand Up @@ -82,4 +91,5 @@ test_that('Test is.theta check.class arugment', {
expect_false(suppressWarnings(is.theta(theta1)))
expect_true( suppressWarnings(is.theta(theta1, check.class = FALSE)))
})

# Test degenerate input

0 comments on commit 3321bac

Please sign in to comment.