Displaying 20 results from an estimated 3000 matches similar to: "fedback from foreach"
2011 Jul 12
2
foreach not recognizing functions in memory
All,
I am not understanding the scoping used in foreach when it is used
inside a function. I keep getting "could not find function" errors for
functions that are in memory when I try to use foreach within a function
call. I have a simple example below. "testFun" is in memory and works
when called by foreach directly, but when I place foreach in a function
called
2012 May 08
1
revolution foreach oddity
I know this is not a revolution support forum, but as anyone noticed the
following?
I have a foreach loop to generate random samples. If I run the exact code
below in normal r (2.14.1) it works as expected, but if I run it from
revolution 4.2.0 each loop returns the same numbers.
The only way I can get revolution to give different numbers is using 1
instead of 8 in
registerDoSNOW(makeCluster(8,
2015 May 11
1
Foreach %dopar% operator incorrectly load balancing
Dear R-SIG-Debian,
I am using R version 3.1.2 with rstudio-server 0.98.113 on debian build
3.2.0-4-amd64 #1 SMP Debian 3.2.68-1+deb7u1 x86_64 GNU/Linux.
I often use the %dopar% operator in from the foreach package to run code in
parallel. However, the only other use on the box seemingly installed a few
items and suddenly %dopar% will use far more than the number of cores I am
specifying and
2011 Feb 25
1
Question about foreach (with doSNOW), is that a bug?
Hi all,
Within a foreach loop with doSNOW, we cant call functions which come from
the non-default package. We need to load(require/library) the package once
more within the foreach loop. Anyone knows why would happen like this? Is it
caused by the snow package and something happened when "snow" parallelize
the job?
Other than load the package once more with in the foreach loop, is
2017 Dec 07
0
parallel computing with foreach()
Your code generates an error that has nothing to do with dopar. I have
no idea what your function stack is supposed to do; you may be
inadvertently calling utils::stack which would produce this kind of
error:
> stack(1:25, RAT = FALSE)
Error in data.frame(values = unlist(unname(x)), ind, stringsAsFactors = FALSE) :
arguments imply differing number of rows: 25, 0
HTH,
Peter
On Wed, Dec 6,
2012 Oct 25
1
parallel processing with foreach
Hi,
I am trying to parallel computing with foreach function, but not able to
get the result. I know that in parallel processing, all result is collected
in list format, but I am not able to get input there.
Any help is really appreciated.
esf.m <-foreach (i = 1:n.s, .combine=rbind) %dopar% {
EV <- as.data.frame(eig$vectors[,1:n.candid[i]])
colnames(EV) <- paste("EV",
2012 Feb 18
3
foreach %do% and %dopar%
Hi everyone,
I'm working on a script trying to use foreach %dopar% but without success,
so I manage to run the code with foreach %do% and looks like this:
The code is part of a MCMC model for projects valuation, returning the most
important results (VPN, TIR, EVA, etc.) of the simulation.
foreach (simx = NsimT, .combine=cbind, .inorder=FALSE, .verbose=TRUE) %do% {
MCPVMPA = MCVAMPA[simx]
2017 Dec 07
2
parallel computing with foreach()
I have used foreach() for parallel computing but in the current problem, it
is not working. Given the volume and type of the data involved in the
analysis, I will try to give below the complete code without reproducible
example.
In short, each R environment will draw a set of separate files, perform the
analysis and dump in separate folders.
splist <- c("juoc", "juos",
2009 Jul 18
1
Building a big.matrix using foreach
Hi there!
I have become a big fan of the 'foreach' package allowing me to do a
lot of stuff in parallel. For example, evaluating the function f on
all elements in a vector x is easily accomplished:
foreach(i=1:length(x),.combine=c) %dopar% f(x[i])
Here the .combine=c option tells foreach to combine output using the
c()-function. That is, to return it as a vector.
Today I discovered the
2009 Oct 08
3
foreach loop - rejection method
Hi Everybody,
Thanks in advance for your help.
This is my first time using the foreach statement and I cant get it to work
properly so here is what i have
test<-function(){
repeat {
cand2[l-1]<-rinvgamma(1,phi,lambda[l-1])
q2<-dinvgamma(cand2[l-1],phi,lambda[l-1])
p2<-cand2[l-1]^-1.5*exp(-y[l]^2/(2*cand2[l-1]))*exp(-((log(cand2[l-1])-mu_t_cand[l-1])^2)/2*sigmasq)
2011 Oct 17
2
Foreach (doMC)
Hello,
I am trying to run a small example with foreach, but I am having some
problems. Here is the code:
*library(doMC)
registerDoMC()
zappa = list()
frank = list()
foreach (i = 1:4) %dopar% {
zappa[[i]] = kmeans (iris[-5],4)
frank[[i]] = warnings()
}*
The code runs without error. However the zappa and frank will be empty
lists.
If I use regular *for *instead, the list will be filled up
2018 Mar 09
2
Package gamlss used inside foreach() and %dopar% fails to find an object
Hello all:
Please help me with this "can't find object" issue. I'm trying to get leave-one-out predicted values for Beta-binomial regression.
It may be the gamlss issue because the code seems to work when %do% is used. I have searched for similar issues, but haven't managed to figure it out. This is on Windows 10 platform.
Thanks in advance,
Nik
#
2018 Mar 09
0
Package gamlss used inside foreach() and %dopar% fails to find an object
If the code you are running in parallel is complicated, maybe foreach is not sophisticated enough to find all the variables you refer to. Maybe use parallel::clusterExport yourself? But be a aware that passing parameters is much safer than directly accessing globals in parallel processing, so this might just be your warning to not do that anyway.
--
Sent from my phone. Please excuse my brevity.
2012 Feb 23
1
segfault when using data.table package in conjunction with foreach
Hi all,
I'm trying to use the package read.table within a foreach loop. I'm
grabbing 500M rows of data at a time from two different files and then
doing an aggregate/tapply like function in read.table after that. I
had planned on doing a foreach loop 39 times at once for the 39 files
I have, but obviously that won't work until I figure out why the
segfault is occurring. The
2012 Aug 01
1
Foreach help!
Hi,
just during these vacation days, I'm trying to approach with multicore
package
and I have some troubles with foreach.
ex.
foreach(.combine=c, ii=1:200, jj=1:500) %dopar% makefunction[ii,jj]
Command seem to work but if I see ii and jj value at the and of cycle, they
are both 200
instead than ii=200 and jj=500.
Why??
Can someone help me?
Thank you in advance.
Max
--
View this
2012 Jan 03
1
Error when using foreach package for parralelization
Hi,
i tried to find the answer but didn't so my apologies if the question is
obvious !
I'm trying to parallelize the following R code :
pk2test =
c(1:16,(12*16+1):(12*16+16),(16*16+1):(16*16+16),(20*16+1):(20*16+16))
score.mat = matrix(nc=16*4,nr=16*4)
for(i in 1:(16*4)) {
for(j in i:(16*4)) {
score.mat[i,j] = score.mat[j,i] =
2011 Jun 28
1
parallel computing with 'foreach'
Hi all,
I would like to parallelize some R code and would like to use the 'foreach'
package with a foreach loop. However, whenever I call a function from an
enabled package outside of MASS, I get an error message that a number of the
functions aren't recognized (even though the functions should be defined).
For example:
library(foreach)
library(doSMP)
library(survival)
# Create the
2012 Jul 24
1
untaring files in parallel with foreach and doSNOW?
Hello,
I'm running some code that requires untaring many files in the first step.
This takes a lot of time and I'd like to do this in parallel, if possible.
If it's the disk reading speed that is the bottleneck I guess I should not
expect an improvement, but perhaps it's the processor. So I want to try this
out.
I'm working on windows 7 with R 2.15.1 and the latest foreach
2011 Feb 11
1
foreach with registerDoMC on R 2.12.0 OSX 10.6 --- errors and warnings
some hints for the search engines.
I just did
install.packages("foreach")
install.packages("doMC")
library(doMC)
registerDoMC()
library(foreach)
> foreach(i = 1:3) %dopar% sqrt(i)
The process has forked and you cannot use this CoreFoundation
functionality safely. You MUST exec().
Break on
2010 Apr 29
2
dopar parallel assignments
Hi guys,
I was wondering why this piece of code doesn't work:
foreach (i = c(1.25,1.50)) %dopar% {
assign(paste("test_",i,sep=""),i)
}
but, this does:
foreach (i = c(1.25,1.50)) %do% {
assign(paste("test_",i,sep=""),i)
}
Obviously, the difference is %dopar% vs. %do%. If I use %do%, I get
objects test_1.25 and test_1.50, but I don't get these