Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

bind.loci

Bind Loci Objects


Description

These functions combine objects of class "loci" by binding their rows or their columns.

Usage

## S3 method for class 'loci'
rbind(...)
## S3 method for class 'loci'
cbind(...)

Arguments

...

some object(s) of class "loci", separated with commas.

Details

These two methods call [rc]bind.data.frame and take care to respect the attribute “locicol” of the returned object.

You can pass a data frame in the ..., but then you should bypass the generic by calling cbind.loci directly. Do not try to pass a vector: this will mess the “locicol” attribute. Instead, make a data frame with this vector (see examples).

Value

An object of class "loci".

Author(s)

Emmanuel Paradis

See Also

[.loci

Examples

a <- as.loci(data.frame(x = "A/a", y = 1), col.loci = 1)
b <- as.loci(data.frame(y = 2, x = "A/A"), col.loci = 2)
## rbind.loci reorders the columns if necessary:
str(rbind(a, b))
## cbind sets "locicol" correctly:
str(cbind(a, b))
str(cbind(b, a))
## Unexpected result...
str(cbind(a, data.frame(z = 10)))
## ... bypass the generic:
str(pegas:::cbind.loci(a, data.frame(z = 10)))
## ... or much better: a$z <- 10
## Here "locicol" is not correct...
str(pegas:::cbind.loci(z = 10, a))
## ... instead
str(pegas:::cbind.loci(data.frame(z = 10), a))

pegas

Population and Evolutionary Genetics Analysis System

v1.0
GPL (>= 2)
Authors
Emmanuel Paradis [aut, cre, cph] (<https://orcid.org/0000-0003-3092-2199>), Thibaut Jombart [aut, cph] (<https://orcid.org/0000-0003-2226-8692>), Zhian N. Kamvar [aut, cph] (<https://orcid.org/0000-0003-1458-7108>), Brian Knaus [aut, cph] (<https://orcid.org/0000-0003-1665-4343>), Klaus Schliep [aut, cph] (<https://orcid.org/0000-0003-2941-0161>), Alastair Potts [aut, cph] (<https://orcid.org/0000-0003-0919-7279>), David Winter [aut, cph] (<https://orcid.org/0000-0002-6165-0029>)
Initial release
2021-04-08

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.