| as.data.frame.ped | R Documentation |
Convert a ped object (or a list of such) to a data frame. The first columns are id,
fid, mid and sex, followed by genotype columns.
## S3 method for class 'ped'
as.data.frame(x, ..., markers, sep = "/", missing = "-")
## S3 method for class 'pedList'
as.data.frame(x, ..., markers, sep = "/", missing = "-")
x |
A |
... |
Further parameters. |
markers |
Vector of marker names or indices. By default, all markers are included. |
sep |
A single string to be used as allele separator in marker genotypes. |
missing |
A single string to be used for missing alleles. |
For lists of pedigrees, use as.data.frame.pedList() directly unless the list has
class "pedList". The reason for this convention is to avoid conflicts with existing
base::as.data.frame.list() method.
Note the difference between as.data.frame.ped() and as.matrix.ped(), which have
different purposes. Conversion to a data frame is primarily intended for pretty
printing. It uses correct labels for pedigree members and marker alleles, and pastes
alleles to form nice-looking genotypes.
The matrix method, on the other hand, is a handy tool for manipulating the pedigree
structure. It produces a numeric matrix, using the internal index labelling both for
individuals and alleles, making it very fast. In addition, all necessary meta
information (loop breakers, allele frequencies a.s.o) is kept as attributes, which
makes it possible to recreate the original ped object.
A data frame with 4 + nMarkers(x) columns.
as.matrix.ped()
x = nuclearPed() |> addMarker(`3` = "1/2", name = "M")
as.data.frame(x)
as.data.frame(x, markers = NULL)
# Ped list with compatible markers
y = list(x, singleton("X")) |> harmoniseMarkers()
as.data.frame.pedList(y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.