as.data.frame.locus: Converts locus to a data frame

View source: R/as_data_frame.R

as.data.frame.locusR Documentation

Converts locus to a data frame

Description

This converts a locus object into a data.frame so that you can use locus objects in a column of a data.frame.

Usage

## S3 method for class 'locus'
as.data.frame(x, ...)

Arguments

x

An object of type code. This can be either a single genotype (a rare case) or a vector of genotypes (preferred).

...

Additional objects that are passed to as.data.frame.vector.

Value

A data.frame object.

Note

If you do not assign a data name to the x in assignment (e.g., TPI=x ) it will name the column in the data.frame the same as the name of the variable you assigned it. If this is confusing see the examples.

Author(s)

Rodney J. Dyer rjdyer@vcu.edu

Examples


loc1 <- c( locus(1:2), locus(1:2), locus( c(1,1) ) )
df <- data.frame( ID=1:3, NAMED_LOCUS=loc1, loc1 )
summary(df)


dyerlab/gstudio documentation built on Feb. 2, 2024, 8:24 p.m.