as.data.frame.ped: Convert ped to data.frame

View source: R/ped_convert.R

as.data.frame.pedR Documentation

Convert ped to data.frame

Description

Convert a ped object to a data.frame. The first columns are id, fid, mid and sex, followed by genotype columns for all (or a selection of) markers.

Usage

## S3 method for class 'ped'
as.data.frame(x, ..., markers, sep = "/", missing = "-")

Arguments

x

Object of class ped.

...

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.

Details

Note that the output of as.data.frame.ped() is quite different from that of as.matrix.ped(). This reflects the fact that these functions 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.

Value

A data.frame with pedsize(x) rows and 4 + nMarkers(x) columns.

See Also

as.matrix.ped()


pedtools documentation built on Nov. 5, 2023, 5:06 p.m.