Learn R Programming

AlphaPart (version 0.9.7)

AlphaPartSubset: AlphaPartSubset.R

Description

A function to choose the partition paths to keep.

Usage

AlphaPartSubset(x, paths = NULL)

Value

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

Arguments

x

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

paths

Character, names of paths to be kept.

Details

Displaying results of partitions for many paths is often confusing. This function helps in selecting only paths of interest. Unspecified paths are removed from the input object x. Meta information is modified accordingly. Default setting does nothing.

See Also

AlphaPart for the main method, summary.AlphaPart for summary method that works on output of AlphaPart, AlphaPartSum for sum method.

Examples

Run this code
## 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, 100,  85, 110))

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

## Keep some partitions (working on object of class AlphaPart)
(tmp2 <- AlphaPartSubset(x=tmp, paths="A"))

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

## Keep some partitions (working on object of class summaryAlphaPart)
(tmpS2 <- AlphaPartSubset(x=tmpS, paths="A"))

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

Run the code above in your browser using DataLab