Learn R Programming

trio (version 3.10.0)

read.pedfile: Reading a Ped File

Description

Reads a ped file into R and creates a data frame in ped format, or transform the ped file into a matrix in genotype format.

Usage

read.pedfile(file, first.row = NA, coded = NULL, naVal = 0, sep = " ", p2g = FALSE, non.rs.IDs = FALSE, cols4ID=FALSE)

Arguments

file
the filename (if necessary with path) of a ped file that should be read into R.
first.row
logical indicating whether the first row of file also contains data for a subject. If FALSE, the first row is assumed to contain the SNP names. By default, read.pedfile tries to figure out automatically if the first column contains the SNP names or data for a subject.
coded
a character string stating how the alleles of the SNPs are coded. Possible values are "12", "AB", "1234", "ATCG". For details, see ped2geno. By default, read.pedfile tries to figure out automatically how the alleles are coded.
naVal
value or character string specifying how missing values in the SNP data are coded.
sep
character string specifying how the SNP names in the first row of file are separated. Ignored if first.row = TRUE.
p2g
logical indicating whether the ped file should be transformed into a matrix in genotype format. If FALSE, a data frame in ped format is returned. Otherwise, ped2geno is called within read.pedfile to transform the data frame into a matrix in genotype format, and the matrix is returned.
non.rs.IDs
logical indicating whether (some of) the SNP names are specified by other names than rs-IDs.
cols4ID
logical indicating whether columns should be added to output matrix containing the family ID and the individual ID. If FALSE, the individual IDs are used as the row names of the output matrix.

Value

p2g = FALSE), or a matrix in genotype format (if p2g = TRUE).

See Also

ped2geno