read.pedfile {trio} | R Documentation

## 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

A data frame in ped format (if `p2g = FALSE`), or a matrix in genotype format (if `p2g = TRUE`).

### Author(s)

Holger Schwender, holger.schwender@udo.edu

### See Also

`ped2geno`

### Examples

    ## Not run:
    # Assuming there is a ped-file called pedfile.ped in the
    # R working directory, this file can be read into R by
    ped <- read.pedfile("pedfile.ped")

    # The resulting data frame is in the typical ped format
    # which needs to be transformed into the genotype format
    # for applications of most of the functions in the trio
    # package. This transformation can be done by
    geno <- ped2geno(ped)

    # This transformation can also be done directly when
    # reading the ped-file into R by
    geno2 <- read.pedfile("pedfile.ped", p2g = TRUE)

    ## End(Not run)

[Package trio version 3.24.3 Index]