R: Print Genotypes to the Console

viewGenotypes {polysat} | R Documentation

## Print Genotypes to the Console

### Description

`viewGenotypes` prints a tab-delimited table of samples, loci, and alleles to the console so that genotypes can be easily viewed.

### Usage

    viewGenotypes(object, samples = Samples(object), loci = Loci(object))

### Arguments

`object` | An object of one of the `gendata` subclasses, containing genotypes to be viewed.
`samples` | A numerical or character vector indicating which samples to display.
`loci` | A numerical or character vector indicating which loci to display.

### Details

`viewGenotypes` is a generic function with methods for `genambig` and `genbinary` objects.

For a `genambig` object, a header line indicating sample, locus, and allele columns is printed. Genotypes are printed below this. Genotypes are ordered first by locus and second by sample.

For a `genbinary` object, the presence/absence matrix is printed, organized by locus. After the matrix for one locus is printed, a blank line is inserted and the matrix for the next locus is printed.

### Value

No value is returned.

### Author(s)

Lindsay V. Clark

### See Also

`Genotypes`

### Examples

    # create a dataset for this example
    mygen <- new("genambig", samples=c("ind1", "ind2", "ind3", "ind4"),
                 loci=c("locA", "locB"))
    Genotypes(mygen) <- array(list(c(98, 104, 108), c(100, 104, 110, 114),
                                   c(102, 108, 110), Missing(mygen),
                                   c(132, 135), c(138, 141, 147),
                                   c(135, 141, 144), c(129, 150)),
                              dim=c(4,2))

    # view the genotypes
    viewGenotypes(mygen)

[Package polysat version 1.7-6 Index]