tests/testthat/test-7-wadist.R

# A is a matrix where columns 6 and 7 are identical
library(amalgam)
A <- randAcomp(5)
A <- cbind(A, cbind(rep(.2, 5), rep(.2, 5)))
A <- sweep(A, 1, rowSums(A), "/")

# B is a matrix where columns 6 and 7 are merged
B <- A
B[,6] <- B[,6] + B[,7]
B <- B[,-7]

test_that("weighted Aitchison distance has distributional equivalence", {

  expect_equal(
    wadist(A),
    wadist(B)
  )
})
tpq/amalgam documentation built on March 14, 2020, 10:27 a.m.