tests/testthat/test-printAlphaPart.R

context("test-print-alphapart")

test_that("Test print.AlphaPart", {
  ## Small pedigree with additive genetic (=breeding) values
  ped <- data.frame(  id=c(  1,   2,   3,   4,   5,   6),
                      fid=c(  0,   0,   2,   0,   4,   0),
                      mid=c(  0,   0,   1,   0,   3,   0),
                      loc=c("A", "A", "C", "B", "C", "C"),
                      trt1=c(100, 120, 115, 130, 125, 125),
                      trt2=c(100, 110, 105, 100,  85, 110),
                      gen=c(  1,   1,   2,   2,   3,   3))
  tmp <- AlphaPart(x=ped, colBV=c("trt1", "trt2"), center = FALSE)
  ## Partition additive genetic values
  expect_equal(print(tmp$trt1[,"trt1_w"], digits=1), c(100,120,5,130,2.5,125))
  expect_equal(print.AlphaPart(AlphaPart(x=ped, colBV=c("trt1", "trt2"), center = FALSE)),NULL)
  expect_equal(print.AlphaPart(AlphaPart(x=ped, colBV=c("trt1", "trt2"), center = TRUE)),NULL)
  expect_equal(print(tmp$info),tmp$info)
})
AlphaGenes/AlphaPart documentation built on Feb. 27, 2025, 7:05 p.m.