calculateSexRatio: Calculates the sex ratio (number of non-males / number of...

Description Usage Arguments Value Examples

View source: R/calculateSexRatio.R

Description

The Males are counted when the ped$sex value is "M". When females are counted when the ped$sex value is not "M". This means animals with ambiguous sex are counted with the females.

Usage

1
calculateSexRatio(ids, ped, additionalMales = 0, additionalFemales = 0)

Arguments

ids

character vector of animal Ids

ped

datatable that is the 'Pedigree'. It contains pedigree information including the IDs listed in candidates.

additionalMales

Integer value of males to add to those within the group when calculating the ratio. Ignored if calculated ratio is 0 or Inf. Default is 0.

additionalFemales

Integer value of females to add to those within the group when calculating the ratio. Ignored if calculated ratio is 0 or Inf. Default is 0.

Value

Numeric value of sex ratio of the animals provided.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
library(nprcgenekeepr)
data("qcBreeders")
data("pedWithGenotype")
available <- c("JGPN6K", "8KM1MP", "I9TQ0T", "Q0RGP7", "VFS0XB", "CQC133",
               "2KULR3", "HOYW0S", "FHV13N", "OUM6QF", "6Z7MD9", "CFPEEU",
               "HLI95R", "RI0O7F", "7M51X5", "DR5GXB", "170ZTZ", "C1ICXL")
nonMales <- c("JGPN6K", "8KM1MP", "I9TQ0T", "Q0RGP7", "CQC133",
              "2KULR3", "HOYW0S", "FHV13N", "OUM6QF", "6Z7MD9", "CFPEEU",
              "HLI95R", "RI0O7F", "7M51X5", "DR5GXB", "170ZTZ", "C1ICXL")
male <- "VFS0XB"
calculateSexRatio(ids = male, ped = pedWithGenotype)
calculateSexRatio(ids = nonMales, ped = pedWithGenotype)
calculateSexRatio(ids = available, ped = pedWithGenotype)
calculateSexRatio(ids = available, ped = pedWithGenotype,
                        additionalMales = 1)
calculateSexRatio(ids = available, ped = pedWithGenotype,
                  additionalFemales = 1)
calculateSexRatio(ids = available, ped = pedWithGenotype,
                  additionalMales = 1, additionalFemales = 1)
calculateSexRatio(ids = nonMales, ped = pedWithGenotype,
                  additionalMales = 1, additionalFemales = 0)
calculateSexRatio(ids = character(0), ped = pedWithGenotype,
                additionalMales = 1, additionalFemales = 0)

rmsharp/nprcmanager documentation built on April 24, 2021, 3:13 p.m.