family: Find families (lines) in the pedigree

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/family.R

Description

family classifies individuals in the pedigree to distinct families or lines. Two individuals are members of one family if they have at least one common ascendant. family<- provides mean to properly add family information into the pedigree.

Usage

1
2
family(x)
family(x, col=NULL) <- value

Arguments

x

pedigree object

col

character, column name in x for family

value

family values for individuals in the pedigree

Details

col provides a mean to name or possibly also rename family column with user specified value, say "familia" in Spanish. When col=NULL, which is default, "family" is used.

Value

A vector of family values (integers)

Author(s)

Gregor Gorjanc

See Also

Pedigree

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  ## Two families examples
  ped <- data.frame(    id=c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11),
                    father=c(0, 0, 0, 0, 0, 0, 5, 1, 3,  8,  7),
                    mother=c(0, 0, 0, 0, 0, 0, 6, 2, 4,  9, 10),
                generation=c(1, 1, 1, 1, 1, 1, 2, 2, 2,  3,  4))
  ped <- Pedigree(ped, unknown=0, generation="generation")
  family(ped)

  ## After break we get two families
  ped1 <- removeIndividual(ped, individual=11)
  family(ped1)

  ## Subsetting can also be used
  family(ped[1:10,])
  family(ped[7:10,])

  ## Pedigree need not be sorted in advance
  ped2 <- ped[sample(1:10), ]
  family(ped2)

  ## Assign family values to pedigree
  family(ped) <- family(ped)
  ped
  family(ped, col="familia") <- family(ped)
  ped

Example output

Loading required package: MASS

Attaching package: 'GeneticsPed'

The following object is masked from 'package:stats':

    family

 1  2  3  4  5  6  7  8  9 10 11 
 1  1  1  1  1  1  1  1  1  1  1 
 1  2  3  4  5  6  7  8  9 10 
 1  1  1  1  2  2  2  1  1  1 
 1  2  3  4  5  6  7  8  9 10 
 1  1  1  1  2  2  2  1  1  1 
 7  8  9 10 
 2  1  1  1 
10  9  4  5  7  2  3  8  1  6 
 1  1  1  2  2  1  1  1  1  2 
   id father mother generation family
1   1     NA     NA          1      1
2   2     NA     NA          1      1
3   3     NA     NA          1      1
4   4     NA     NA          1      1
5   5     NA     NA          1      1
6   6     NA     NA          1      1
7   7      5      6          2      1
8   8      1      2          2      1
9   9      3      4          2      1
10 10      8      9          3      1
11 11      7     10          4      1
   id father mother generation familia
1   1     NA     NA          1       1
2   2     NA     NA          1       1
3   3     NA     NA          1       1
4   4     NA     NA          1       1
5   5     NA     NA          1       1
6   6     NA     NA          1       1
7   7      5      6          2       1
8   8      1      2          2       1
9   9      3      4          2       1
10 10      8      9          3       1
11 11      7     10          4       1

GeneticsPed documentation built on Nov. 8, 2020, 5:54 p.m.