AlphaPartSum: AlphaPartSum.R

Description Usage Arguments Details Value See Also Examples

Description

A function to sum partitions of several paths.

Usage

1
2
3
4
5
6
7
AlphaPartSum(
  x,
  map = NULL,
  remove = TRUE,
  zeroPath = TRUE,
  call = "AlphaPartSum"
)

Arguments

x

summaryAlphaPart, object from the AlphaPart(...) or summary(AlphaPart(...), ...) call.

map

List, a map of summing paths; see details and examples.

remove

Logical, remove original paths or not.

zeroPath

Logical, set called path to zero if it does not exist.

call

character, for internal use with AlphaPartSubset).

Details

Sometimes partitions of particular paths are very small or we want to sum paths that have some similarity. These actions are easy to achive manually but this functions provides a way to do this consistently with the given object x.

Arguments map must be a list of vectors of length at least two. Vectors of length one are skipped. The idea is that the first element is the new or existing path into which we add up all the remaining specified paths, say list(c("A", "B"), c("X", "X", "Y"), c("Z", "X")) would imply A = B, X = X + Y, and Z = X = X + Y. Note that once X is changed its changed value is used in further calculations. Specify different (new) names for new targets if you want to avoid this.

Be carefull with remove=TRUE, which is the default setting, as all partitions defined after the first (target/new) partition in vector in list will be removed, for example with list(c("A", "B"), c("X", "X", "Y"), c("Z", "X")) partitions B and Y will be removed, while X will not be removed as it is defined as a target/new partition.

Value

An object of class AlphaPart or summaryAlphaPart with modified partitions. Meta information in slot "info" is modified as well.

See Also

AlphaPart for the main method, summary.AlphaPart for summary method that works on output of AlphaPart, AlphaPartSubset for subset/keep method

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## 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,   3),
                  loc=c("A", "B", "A", "B", "A", "A"),
                  gen=c(  1,   1,   2,   2,   3,   3),
                 trt1=c(100, 120, 115, 130, 125, 125),
                 trt2=c(100, 110, 105,  140,  85, 110))

## Partition additive genetic values
(tmp <- AlphaPart(x=ped, colBV=c("trt1", "trt2")))

## Sum some partitions (working on object of class AlphaPart)
(tmp2 <- AlphaPartSum(x=tmp, map=list(c("X", "A", "B"), c("A", "B"))))

## Summarize by generation
(tmpS <- summary(tmp, by="gen"))

## Sum some partitions (working on object of class summaryAlphaPart)
(tmpS2 <- AlphaPartSum(x=tmpS, map=list(c("X", "A", "B"), c("A", "B"))))

## ... must be equal to
(tmpS3 <- summary(tmp2, by="gen"))

AlphaPart documentation built on March 25, 2020, 5:13 p.m.