Description Usage Arguments Details Value Author(s) See Also Examples
These functions combine objects of class "loci"
by binding
their rows or their columns.
1 2 3 4 |
... |
some object(s) of class |
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).
An object of class "loci"
.
Emmanuel Paradis
[.loci
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 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))
|
Loading required package: ape
Loading required package: adegenet
Loading required package: ade4
/// adegenet 2.0.1 is loaded ////////////
> overview: '?adegenet'
> tutorials/doc/questions: 'adegenetWeb()'
> bug reports/feature requests: adegenetIssues()
Attaching package: 'pegas'
The following object is masked from 'package:ade4':
amova
The following object is masked from 'package:ape':
mst
Classes 'loci' and 'data.frame': 2 obs. of 2 variables:
$ x: Factor w/ 2 levels "A/a","A/A": 1 2
$ y: num 1 2
- attr(*, "locicol")= num 1
Classes 'loci' and 'data.frame': 1 obs. of 4 variables:
$ x: Factor w/ 1 level "A/a": 1
$ y: num 1
$ y: num 2
$ x: Factor w/ 1 level "A/A": 1
- attr(*, "locicol")= num 1 4
Classes 'loci' and 'data.frame': 1 obs. of 4 variables:
$ y: num 2
$ x: Factor w/ 1 level "A/A": 1
$ x: Factor w/ 1 level "A/a": 1
$ y: num 1
- attr(*, "locicol")= num 2 3
List of 4
$ : Factor w/ 1 level "A/a": 1
$ : num 1
$ : num 10
$ : num 10
- attr(*, "dim")= int [1:2] 2 2
- attr(*, "dimnames")=List of 2
..$ : chr [1:2] "x" "y"
..$ : chr [1:2] "a" ""
Classes 'loci' and 'data.frame': 1 obs. of 3 variables:
$ x: Factor w/ 1 level "A/a": 1
$ y: num 1
$ z: num 10
- attr(*, "locicol")= num 1
Classes 'loci' and 'data.frame': 1 obs. of 3 variables:
$ x[[1]]: num 10
$ x : Factor w/ 1 level "A/a": 1
$ y : num 1
- attr(*, "locicol")= Named num 3
..- attr(*, "names")= chr ""
Classes 'loci' and 'data.frame': 1 obs. of 3 variables:
$ z: num 10
$ x: Factor w/ 1 level "A/a": 1
$ y: num 1
- attr(*, "locicol")= num 2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.