File: productExample.R

package info (click to toggle)
r-cran-itertools 0.1-3-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 316 kB
  • sloc: makefile: 2
file content (12 lines) | stat: -rw-r--r-- 299 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
library(itertools)
library(foreach)

it <- product(a=LETTERS[1:10], b=1, x=1:3)

success <- 
  foreach(a=LETTERS[1:10], .combine='c', .final=all) %:%
    foreach(b=1, .combine='c') %:%
      foreach(x=1:3, actual=it, .combine='c') %do%
        identical(list(a=a, b=b, x=x), actual)

print(success)