Skip to contents

Count siblings of each individual

Usage

countSiblings(ped, personID = "ID", momID = "momID", dadID = "dadID")

Arguments

ped

A data frame containing the pedigree information

personID

character. Name of the column in ped for the person ID variable

momID

character. Name of the column in ped for the mother ID variable

dadID

character. Name of the column in ped for the father ID variable

Value

A data frame with an additional column, siblings, that contains the number of siblings for each individual

Examples

library(BGmisc)
data("potter")
countSiblings(potter, personID = "personID")
#>    personID famID               name gen momID dadID spouseID sex parentsID
#> 1         1     1     Vernon Dursley   1   101   102        3   1   101.102
#> 2         2     1   Marjorie Dursley   1   101   102       NA   0   101.102
#> 3         3     1      Petunia Evans   1   103   104        1   0   103.104
#> 4         4     1         Lily Evans   1   103   104        5   0   103.104
#> 5         5     1       James Potter   1    NA    NA        4   1      <NA>
#> 6         6     1     Dudley Dursley   2     3     1       NA   1       3.1
#> 7         7     1       Harry Potter   2     4     5        8   1       4.5
#> 8         8     1      Ginny Weasley   2    10     9        7   0      10.9
#> 9         9     1     Arthur Weasley   1    NA    NA       10   1      <NA>
#> 10       10     1      Molly Prewett   1    NA    NA        9   0      <NA>
#> 11       11     1        Ron Weasley   2    10     9       17   1      10.9
#> 12       12     1       Fred Weasley   2    10     9       NA   1      10.9
#> 13       13     1     George Weasley   2    10     9       NA   1      10.9
#> 14       14     1      Percy Weasley   2    10     9       20   1      10.9
#> 15       15     1    Charlie Weasley   2    10     9       NA   1      10.9
#> 16       16     1       Bill Weasley   2    10     9       18   1      10.9
#> 17       17     1   Hermione Granger   2    NA    NA       11   0      <NA>
#> 18       18     1     Fleur Delacour   2   105   106       16   0   105.106
#> 19       19     1 Gabrielle Delacour   2   105   106       NA   0   105.106
#> 20       20     1     Audrey UNKNOWN   2    NA    NA       14   0      <NA>
#> 21       21     1    James Potter II   3     8     7       NA   1       8.7
#> 22       22     1       Albus Potter   3     8     7       NA   1       8.7
#> 23       23     1        Lily Potter   3     8     7       NA   0       8.7
#> 24       24     1       Rose Weasley   3    17    11       NA   0     17.11
#> 25       25     1       Hugo Weasley   3    17    11       NA   1     17.11
#> 26       26     1   Victoire Weasley   3    18    16       NA   0     18.16
#> 27       27     1  Dominique Weasley   3    18    16       NA   0     18.16
#> 28       28     1      Louis Weasley   3    18    16       NA   1     18.16
#> 29       29     1      Molly Weasley   3    20    14       NA   0     20.14
#> 30       30     1       Lucy Weasley   3    20    14       NA   0     20.14
#> 31      101     1     Mother Dursley   0    NA    NA      102   0      <NA>
#> 32      102     1     Father Dursley   0    NA    NA      101   1      <NA>
#> 34      103     1       Mother Evans   0    NA    NA      104   0      <NA>
#> 33      104     1       Father Evans   0    NA    NA      103   1      <NA>
#> 36      105     1    Mother Delacour   0    NA    NA      106   0      <NA>
#> 35      106     1    Father Delacour   0    NA    NA      105   1      <NA>
#>    siborder siblings
#> 1         1        1
#> 2         2        1
#> 3         1        1
#> 4         2        1
#> 5         1        0
#> 6         1        0
#> 7         1        0
#> 8         1        6
#> 9         1        0
#> 10        1        0
#> 11        2        6
#> 12        3        6
#> 13        4        6
#> 14        5        6
#> 15        6        6
#> 16        7        6
#> 17        1        0
#> 18        1        1
#> 19        2        1
#> 20        1        0
#> 21        1        2
#> 22        2        2
#> 23        3        2
#> 24        1        1
#> 25        2        1
#> 26        1        2
#> 27        2        2
#> 28        3        2
#> 29        1        1
#> 30        2        1
#> 31        1        0
#> 32        1        0
#> 34        1        0
#> 33        1        0
#> 36        1        0
#> 35        1        0