File: recycleTest.R

package info (click to toggle)
r-cran-iterators 1.0.14-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 600 kB
  • sloc: sh: 29; makefile: 2
file content (13 lines) | stat: -rw-r--r-- 332 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
# simple test of recycle
test01 <- function() {
  if (require(foreach, quietly=TRUE)) {
    nr <- 21
    nc <- 17
    x <- rnorm(nr)
    it <- iter(x, recycle=TRUE)
    actual <- foreach(y=it, icount(nr*nc), .combine='c') %do% y
    dim(actual) <- c(nr, nc)
    expected <- matrix(x, nr, nc)
    checkEquals(actual, expected)
  }
}