extra: Return or set the extra data columns of an object of class...

Description Usage Arguments Value Author(s) Examples

Description

Return or set the extra data columns of an object of class genalex. When getting extra data columns, if there are none, NULL is returned. When setting, this is more than a shortcut for attr(x, "extra.columns") <- value. It checks that both value and x have the same number of rows, generating an error if not, and it sets the row names of value to be equal to the sample names in x before assigning value to the "extra.columns" attribute.

Usage

1
2
extra(x, ...)
extra(x) <- value

Arguments

x

An annotated data frame of class genalex or of class 'loci' converted from class genalex with as.loci

value

When setting extra columns, a data frame or object that can be coerced to a data frame. This is done using stringsAsFactors = FALSE. value must have the same number of rows as x.

...

Additional arguments, currently ignored

Value

A data frame containing extra columns from x, or NULL if extra columns do not exist. If setting, an object of class genalex with its "extra.columns" attribute set to value, after its rownames are adjusted as described above.

Author(s)

Douglas G. Scofield

Examples

1
2
3
4
5
6
data(Qagr_adult_genotypes)
x1 <- attr(Qagr_adult_genotypes, "extra.columns")
x2 <- extra(Qagr_adult_genotypes)
## there are no extra columns, so both should be NULL
if (! isTRUE(all.equal(x1, x2)) || ! is.null(x1) || ! is.null(x2))
    cat("something went wrong")

douglasgscofield/readGenalex documentation built on May 15, 2019, 10:43 a.m.