makePedigreeNumeric: Converts a pedigree with individuals specified as factors to...

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

Description

Some internal pedantics modules require that pedigrees be specified only by numerical values, including numerical values for missing data, this provides that conversion

Usage

1
makePedigreeNumeric(id, sire, dam, missingVal = NULL)

Arguments

id

Individual identifiers - pass using as.character()

sire

Sire codes - pass using as.character()

dam

Dam codes - pass using as.character()

missingVal

the indicator that should be substituted for missing values

Value

numericPedigree

The factor pedigree in numeric form

idKey

A key to facilitate conversion back to the original identifiers

Author(s)

Michael Morrissey michael.morrissey@st-andrews.ac.uk

References

Morrissey, M.B, and A.J. Wilson, 2009. pedantics, an R package for pedigree-based genetic simulation, and pedigree manipulation, characterisation, and viewing. Molecular Ecology Resources.

See Also

makePedigreeFactor

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
26
pedigree<-as.data.frame(matrix(c(
"m1",	NA,	NA,
"m2",	NA,	NA,
"m3",	NA,	NA,
"d4",	NA,	NA,
"d5",	NA,	NA,
"o6",	"m1",	"d4",
"o7",	"m1",	"d4",
"o8",	"m1",	"d4",
"o9",	"m1",	"d4",
"o10",	"m2",	"d5",
"o11",	"m2",	"d5",
"o12",	"m2",	"d5",
"o13",	"m2",	"d5",
"o14",	"m3",	"d5",
"o15",	"m3",	"d5",
"o16",	"m3",	"d5",
"o17",	"m3",	"d5"),17,3,byrow=TRUE))
names(pedigree)<-c("id","dam","sire")
for(x in 1:3) pedigree[,x]<-as.factor(pedigree[,x])

## make the test pedigree numeric with NAs denoted by -1
makePedigreeNumeric(id=as.character(pedigree[,1]),
                          dam=as.character(pedigree[,2]),
                          sire=as.character(pedigree[,3]),
                          missingVal=-1)

Example output

Loading required package: MasterBayes
Loading required package: coda
Loading required package: genetics
Loading required package: combinat

Attaching package: 'combinat'

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

    combn

Loading required package: gdata
sh: 1: cannot create /dev/null: Permission denied
gdata: Unable to locate valid perl interpreter
gdata: 
gdata: read.xls() will be unable to read Excel XLS and XLSX files
gdata: unless the 'perl=' argument is used to specify the location of a
gdata: valid perl intrpreter.
gdata: 
gdata: (To avoid display of this message in the future, please ensure
gdata: perl is installed and available on the executable search path.)
sh: 1: cannot create /dev/null: Permission denied
gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLX' (Excel 97-2004) files.

gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLSX' (Excel 2007+) files.

gdata: Run the function 'installXLSXsupport()'
gdata: to automatically download and install the perl
gdata: libaries needed to support Excel XLS and XLSX formats.

Attaching package: 'gdata'

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

    nobs

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

    object.size

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

    startsWith

Loading required package: gtools
Loading required package: MASS
Loading required package: mvtnorm


NOTE: THIS PACKAGE IS NOW OBSOLETE.



  The R-Genetics project has developed an set of enhanced genetics

  packages to replace 'genetics'. Please visit the project homepage

  at http://rgenetics.org for informtion.




Attaching package: 'genetics'

The following objects are masked from 'package:base':

    %in%, as.factor, order

Loading required package: kinship2
Loading required package: Matrix
Loading required package: quadprog
Loading required package: MCMCglmm
Loading required package: ape
Loading required package: grid
$numericPedigree
   id sire dam
1   3   -1  -1
2   4   -1  -1
3   5   -1  -1
4   1   -1  -1
5   2   -1  -1
6  14    1   3
7  15    1   3
8  16    1   3
9  17    1   3
10  6    2   4
11  7    2   4
12  8    2   4
13  9    2   4
14 10    2   5
15 11    2   5
16 12    2   5
17 13    2   5

$idKey
   pn   pf
1   3   m1
2   4   m2
3   5   m3
4   1   d4
5   2   d5
6  14   o6
7  15   o7
8  16   o8
9  17   o9
10  6  o10
11  7  o11
12  8  o12
13  9  o13
14 10  o14
15 11  o15
16 12  o16
17 13  o17
18 -1 <NA>

pedantics documentation built on May 1, 2019, 10:54 p.m.