An even faster version of expand.grid

Description

This should be faster than expand.grid, which "[c]reate[s] a data frame from all combinations of the supplied vectors or factors" (R documentation).

Usage

1
  expand.grid.jc(seq1, seq2)

Arguments

seq1

A sequence of elements

seq2

A sequence of elements

Details

The source of this function was this discussion thread: http://stackoverflow.com/questions/10405637/use-outer-instead-of-expand-grid

Value

matrix_of_combinations A matrix of all the possible combinations.

Note

Go BEARS!

Author(s)

Nicholas J. Matzke matzke@berkeley.edu

References

http://phylo.wikidot.com/matzke-2013-international-biogeography-society-poster

Matzke_2012_IBS

See Also

convolve, expand.grid, expand.grid.jc

Examples

1
2
3
4
5
6
testval=1
seq1 = c("A","B","C")
seq2 = seq1
expand.grid(seq1,seq2)
expand.grid.alt(seq1,seq2)
expand.grid.jc(seq1,seq2)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.