icartes: Cartesian Product Iterator

Description Usage Arguments Details Value Examples

Description

Create an iterator going through Cartesian product of several items.

Usage

1
2
3

Arguments

nvec

integer vector of number of items

...

set of iterables (subsettable by [)

Details

Value

iterator object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
x <- icartes(c(3, 2, 4))
ct <- 0
while (hasNext(x))
{
  ct <- ct + 1
  i <- nextElem(x)
  cat(sprintf("%3d : %s\n", ct, paste0(i, collapse = " ")))
}

x <- icartesv(Month=c("Jan", "Feb", "Mar"),
              Loc=c("NY", "LA"),
              By=c("car", "plane", "bus"))
as.list(x)

kota7/combiter documentation built on May 20, 2019, 1:10 p.m.