diff -Nru r-cran-foreach-1.4.0/DESCRIPTION r-cran-foreach-1.4.1/DESCRIPTION --- r-cran-foreach-1.4.0/DESCRIPTION 2012-04-16 06:09:53.000000000 +0000 +++ r-cran-foreach-1.4.1/DESCRIPTION 2013-06-06 17:39:33.000000000 +0000 @@ -1,8 +1,8 @@ Package: foreach Type: Package Title: Foreach looping construct for R -Version: 1.4.0 -Author: Revolution Analytics +Version: 1.4.1 +Author: Revolution Analytics, Steve Weston Maintainer: Revolution Analytics Description: Support for the foreach looping construct. Foreach is an idiom that allows for iterating over elements in a collection, @@ -19,6 +19,8 @@ License: Apache License (== 2.0) Repository: CRAN Repository/R-Forge/Project: foreach -Repository/R-Forge/Revision: 22 -Packaged: 2012-04-13 19:51:13 UTC; rforge -Date/Publication: 2012-04-16 06:09:53 +Repository/R-Forge/Revision: 24 +Repository/R-Forge/DateTimeStamp: 2013-05-29 21:06:49 +Date/Publication: 2013-06-06 19:39:33 +Packaged: 2013-05-31 15:37:59 UTC; rforge +NeedsCompilation: no diff -Nru r-cran-foreach-1.4.0/MD5 r-cran-foreach-1.4.1/MD5 --- r-cran-foreach-1.4.0/MD5 2012-04-16 06:09:53.000000000 +0000 +++ r-cran-foreach-1.4.1/MD5 2013-06-06 17:39:34.000000000 +0000 @@ -1,18 +1,20 @@ -138aa66013a68444b9300e5bd1644b43 *DESCRIPTION +5ce77c278033c7ae7cfe50113dc1f767 *DESCRIPTION c32fc6487cdb79913750f7097de2075f *NAMESPACE -30bc1844d81b52c7b15ba18648308e14 *NEWS +c4b02ef0b5c0765c12c527e1ca1f70a9 *NEWS 47e33082104d2bc4bbf6903a8f5ee69a *R/acc.R 5027fbd0eb0875545deefc4e77df3085 *R/do.R a7eea424b2f51e3fdc52da6a58a0c278 *R/foreach.R -5663b485e61fe4127c4a55d80ccb3e71 *R/getsyms.R +e0b326499355bbf084ae160b01ea797f *R/getsyms.R ba7e6bee7fc596e6ee08feaa2ee44a62 *R/times.R 85b4a5712555f13aefa4d723ba78fcd9 *R/zzz.R caa28a573b448cbd60f22052c2bca7a3 *demo/00Index 515798525e9e08e68a66ab24df3d17a0 *demo/sincSEQ.R +114454e06e155812fbd7de0001ef5dc2 *inst/doc/foreach.R f8ac22a80a28c04f29ae2a88686d07b7 *inst/doc/foreach.Rnw -e23b13b994fcc332fc3c449f1d41ad57 *inst/doc/foreach.pdf +3f375e8e57a83bbbaa22e03fac92d510 *inst/doc/foreach.pdf +509eb035fb2bee0b47433e2a00960b50 *inst/doc/nested.R b58f77e7ee3b70d93050f5bb19502b5a *inst/doc/nested.Rnw -4e42381845e79aa70c3590fa30803939 *inst/doc/nested.pdf +10e9cc2adb28045d7ff23ed776eba77a *inst/doc/nested.pdf 3380c6bfe2789c1316d36c368d968bc1 *inst/examples/apply.R 500fc0fa2cb4b07b809e974bc99ba4b9 *inst/examples/bigmax.R 4549e5165479d323e9348b2d726de9da *inst/examples/bigmean.R diff -Nru r-cran-foreach-1.4.0/NEWS r-cran-foreach-1.4.1/NEWS --- r-cran-foreach-1.4.0/NEWS 2012-04-13 16:49:35.000000000 +0000 +++ r-cran-foreach-1.4.1/NEWS 2013-05-29 21:06:49.000000000 +0000 @@ -1,6 +1,10 @@ NEWS/ChangeLog for foreach -------------------------- +1.4.1 2013-05-29 + o Improved handling of implicitly exported objects, courtesy of + Steve Weston. + 1.4.0 2012-04-11 o Removed spurious warning from getDoSEQ. Bug report from Ben Barnes. diff -Nru r-cran-foreach-1.4.0/R/getsyms.R r-cran-foreach-1.4.1/R/getsyms.R --- r-cran-foreach-1.4.0/R/getsyms.R 2010-11-22 19:31:18.000000000 +0000 +++ r-cran-foreach-1.4.1/R/getsyms.R 2013-05-27 22:33:15.000000000 +0000 @@ -83,7 +83,9 @@ # if this is a function, check if we should change the # enclosing environment to be this new environment - if (is.function(val) && identical(environment(val), env)) + fenv <- environment(val) + if (is.function(val) && + (identical(fenv, env) || identical(fenv, .GlobalEnv))) environment(val) <- e assign(s, val, e) diff -Nru r-cran-foreach-1.4.0/debian/changelog r-cran-foreach-1.4.1/debian/changelog --- r-cran-foreach-1.4.0/debian/changelog 2013-06-07 05:12:40.000000000 +0000 +++ r-cran-foreach-1.4.1/debian/changelog 2013-06-07 05:12:40.000000000 +0000 @@ -1,3 +1,11 @@ +r-cran-foreach (1.4.1-1) unstable; urgency=low + + * New upstream release + + * debian/control: Set Build-Depends: to current R version + + -- Dirk Eddelbuettel Thu, 06 Jun 2013 17:02:37 -0500 + r-cran-foreach (1.4.0-2) unstable; urgency=low * debian/control: Set Build-Depends: to current R version diff -Nru r-cran-foreach-1.4.0/debian/control r-cran-foreach-1.4.1/debian/control --- r-cran-foreach-1.4.0/debian/control 2013-06-07 05:12:40.000000000 +0000 +++ r-cran-foreach-1.4.1/debian/control 2013-06-07 05:12:40.000000000 +0000 @@ -2,7 +2,7 @@ Section: gnu-r Priority: optional Maintainer: Dirk Eddelbuettel -Build-Depends: debhelper (>= 7.0.0), r-base-dev (>= 3.0.0~20130327), cdbs, r-cran-codetools, r-cran-iterators +Build-Depends: debhelper (>= 7.0.0), r-base-dev (>= 3.0.1), cdbs, r-cran-codetools, r-cran-iterators Standards-Version: 3.9.4 Homepage: http://cran.r-project.org/web/packages/foreach/index.html diff -Nru r-cran-foreach-1.4.0/inst/doc/foreach.R r-cran-foreach-1.4.1/inst/doc/foreach.R --- r-cran-foreach-1.4.0/inst/doc/foreach.R 1970-01-01 00:00:00.000000000 +0000 +++ r-cran-foreach-1.4.1/inst/doc/foreach.R 2013-05-31 15:37:58.000000000 +0000 @@ -0,0 +1,256 @@ +### R code from vignette source 'foreach.Rnw' + +################################################### +### code chunk number 1: loadLibs +################################################### +library(foreach) + + +################################################### +### code chunk number 2: ex1 +################################################### +x <- foreach(i=1:3) %do% sqrt(i) +x + + +################################################### +### code chunk number 3: ex2 +################################################### +x <- foreach(a=1:3, b=rep(10, 3)) %do% (a + b) +x + + +################################################### +### code chunk number 4: ex3 +################################################### +x <- foreach(a=1:3, b=rep(10, 3)) %do% { + a + b +} +x + + +################################################### +### code chunk number 5: ex4 +################################################### +x <- foreach(a=1:1000, b=rep(10, 2)) %do% { + a + b +} +x + + +################################################### +### code chunk number 6: ex5 +################################################### +x <- foreach(i=1:3, .combine='c') %do% exp(i) +x + + +################################################### +### code chunk number 7: ex6 +################################################### +x <- foreach(i=1:4, .combine='cbind') %do% rnorm(4) +x + + +################################################### +### code chunk number 8: ex7 +################################################### +x <- foreach(i=1:4, .combine='+') %do% rnorm(4) +x + + +################################################### +### code chunk number 9: ex7.1 +################################################### +cfun <- function(a, b) NULL +x <- foreach(i=1:4, .combine='cfun') %do% rnorm(4) +x + + +################################################### +### code chunk number 10: ex7.2 +################################################### +cfun <- function(...) NULL +x <- foreach(i=1:4, .combine='cfun', .multicombine=TRUE) %do% rnorm(4) +x + + +################################################### +### code chunk number 11: ex7.2 +################################################### +cfun <- function(...) NULL +x <- foreach(i=1:4, .combine='cfun', .multicombine=TRUE, .maxcombine=10) %do% rnorm(4) +x + + +################################################### +### code chunk number 12: ex7.3 +################################################### +foreach(i=4:1, .combine='c') %dopar% { + Sys.sleep(3 * i) + i +} +foreach(i=4:1, .combine='c', .inorder=FALSE) %dopar% { + Sys.sleep(3 * i) + i +} + + +################################################### +### code chunk number 13: ex8 +################################################### +library(iterators) +x <- foreach(a=irnorm(4, count=4), .combine='cbind') %do% a +x + + +################################################### +### code chunk number 14: ex9 +################################################### +set.seed(123) +x <- foreach(a=irnorm(4, count=1000), .combine='+') %do% a +x + + +################################################### +### code chunk number 15: ex10 +################################################### +set.seed(123) +x <- numeric(4) +i <- 0 +while (i < 1000) { + x <- x + rnorm(4) + i <- i + 1 +} +x + + +################################################### +### code chunk number 16: ex11 +################################################### +set.seed(123) +x <- foreach(icount(1000), .combine='+') %do% rnorm(4) +x + + +################################################### +### code chunk number 17: ex12.data +################################################### +x <- matrix(runif(500), 100) +y <- gl(2, 50) + + +################################################### +### code chunk number 18: ex12.load +################################################### +library(randomForest) + + +################################################### +### code chunk number 19: ex12.seq +################################################### +rf <- foreach(ntree=rep(250, 4), .combine=combine) %do% + randomForest(x, y, ntree=ntree) +rf + + +################################################### +### code chunk number 20: ex12.par +################################################### +rf <- foreach(ntree=rep(250, 4), .combine=combine, .packages='randomForest') %dopar% + randomForest(x, y, ntree=ntree) +rf + + +################################################### +### code chunk number 21: ex13.orig +################################################### +applyKernel <- function(newX, FUN, d2, d.call, dn.call=NULL, ...) { + ans <- vector("list", d2) + for(i in 1:d2) { + tmp <- FUN(array(newX[,i], d.call, dn.call), ...) + if(!is.null(tmp)) ans[[i]] <- tmp + } + ans +} +applyKernel(matrix(1:16, 4), mean, 4, 4) + + +################################################### +### code chunk number 22: ex13.first +################################################### +applyKernel <- function(newX, FUN, d2, d.call, dn.call=NULL, ...) { + foreach(i=1:d2) %dopar% + FUN(array(newX[,i], d.call, dn.call), ...) +} +applyKernel(matrix(1:16, 4), mean, 4, 4) + + +################################################### +### code chunk number 23: ex13.second +################################################### +applyKernel <- function(newX, FUN, d2, d.call, dn.call=NULL, ...) { + foreach(x=iter(newX, by='col')) %dopar% + FUN(array(x, d.call, dn.call), ...) +} +applyKernel(matrix(1:16, 4), mean, 4, 4) + + +################################################### +### code chunk number 24: ex13.iter +################################################### +iblkcol <- function(a, chunks) { + n <- ncol(a) + i <- 1 + + nextElem <- function() { + if (chunks <= 0 || n <= 0) stop('StopIteration') + m <- ceiling(n / chunks) + r <- seq(i, length=m) + i <<- i + m + n <<- n - m + chunks <<- chunks - 1 + a[,r, drop=FALSE] + } + + structure(list(nextElem=nextElem), class=c('iblkcol', 'iter')) +} +nextElem.iblkcol <- function(obj) obj$nextElem() + + +################################################### +### code chunk number 25: ex13.third +################################################### +applyKernel <- function(newX, FUN, d2, d.call, dn.call=NULL, ...) { + foreach(x=iblkcol(newX, 3), .combine='c', .packages='foreach') %dopar% { + foreach(i=1:ncol(x)) %do% FUN(array(x[,i], d.call, dn.call), ...) + } +} +applyKernel(matrix(1:16, 4), mean, 4, 4) + + +################################################### +### code chunk number 26: when +################################################### +x <- foreach(a=irnorm(1, count=10), .combine='c') %:% when(a >= 0) %do% sqrt(a) +x + + +################################################### +### code chunk number 27: qsort +################################################### +qsort <- function(x) { + n <- length(x) + if (n == 0) { + x + } else { + p <- sample(n, 1) + smaller <- foreach(y=x[-p], .combine=c) %:% when(y <= x[p]) %do% y + larger <- foreach(y=x[-p], .combine=c) %:% when(y > x[p]) %do% y + c(qsort(smaller), x[p], qsort(larger)) + } +} + +qsort(runif(12)) + + Binary files /tmp/5COO9UcAB9/r-cran-foreach-1.4.0/inst/doc/foreach.pdf and /tmp/5swfOXew4F/r-cran-foreach-1.4.1/inst/doc/foreach.pdf differ diff -Nru r-cran-foreach-1.4.0/inst/doc/nested.R r-cran-foreach-1.4.1/inst/doc/nested.R --- r-cran-foreach-1.4.0/inst/doc/nested.R 1970-01-01 00:00:00.000000000 +0000 +++ r-cran-foreach-1.4.1/inst/doc/nested.R 2013-05-31 15:37:58.000000000 +0000 @@ -0,0 +1,127 @@ +### R code from vignette source 'nested.Rnw' + +################################################### +### code chunk number 1: loadLibs +################################################### +library(foreach) +registerDoSEQ() + + +################################################### +### code chunk number 2: init1 +################################################### +sim <- function(a, b) 10 * a + b +avec <- 1:2 +bvec <- 1:4 + + +################################################### +### code chunk number 3: for1 +################################################### +x <- matrix(0, length(avec), length(bvec)) +for (j in 1:length(bvec)) { + for (i in 1:length(avec)) { + x[i,j] <- sim(avec[i], bvec[j]) + } +} +x + + +################################################### +### code chunk number 4: foreach1 +################################################### +x <- + foreach(b=bvec, .combine='cbind') %:% + foreach(a=avec, .combine='c') %do% { + sim(a, b) + } +x + + +################################################### +### code chunk number 5: foreach2 +################################################### +x <- + foreach(b=bvec, .combine='cbind') %:% + foreach(a=avec, .combine='c') %dopar% { + sim(a, b) + } +x + + +################################################### +### code chunk number 6: foreach3 +################################################### +opts <- list(chunkSize=2) +x <- + foreach(b=bvec, .combine='cbind', .options.nws=opts) %:% + foreach(a=avec, .combine='c') %dopar% { + sim(a, b) + } +x + + +################################################### +### code chunk number 7: init2 +################################################### +sim <- function(a, b) { + x <- 10 * a + b + err <- abs(a - b) + list(x=x, err=err) +} + + +################################################### +### code chunk number 8: for2 +################################################### +n <- length(bvec) +d <- data.frame(x=numeric(n), a=numeric(n), b=numeric(n), err=numeric(n)) + +for (j in 1:n) { + err <- Inf + best <- NULL + for (i in 1:length(avec)) { + obj <- sim(avec[i], bvec[j]) + if (obj$err < err) { + err <- obj$err + best <- data.frame(x=obj$x, a=avec[i], b=bvec[j], err=obj$err) + } + } + d[j,] <- best +} +d + + +################################################### +### code chunk number 9: innercombine +################################################### +comb <- function(d1, d2) if (d1$err < d2$err) d1 else d2 + + +################################################### +### code chunk number 10: foreach4 +################################################### +opts <- list(chunkSize=2) +d <- + foreach(b=bvec, .combine='rbind', .options.nws=opts) %:% + foreach(a=avec, .combine='comb', .inorder=FALSE) %dopar% { + obj <- sim(a, b) + data.frame(x=obj$x, a=a, b=b, err=obj$err) + } +d + + +################################################### +### code chunk number 11: foreach5 +################################################### +library(iterators) +opts <- list(chunkSize=2) +d <- + foreach(b=bvec, j=icount(), .combine='rbind', .options.nws=opts) %:% + foreach(a=avec, i=icount(), .combine='comb', .inorder=FALSE) %dopar% { + obj <- sim(a, b) + data.frame(x=obj$x, i=i, j=j, err=obj$err) + } +d + + Binary files /tmp/5COO9UcAB9/r-cran-foreach-1.4.0/inst/doc/nested.pdf and /tmp/5swfOXew4F/r-cran-foreach-1.4.1/inst/doc/nested.pdf differ