Hi Vivek,
On Thu, Apr 29, 2010 at 8:37 PM, Vivek Ayer wrote:
> Hi David,
>
> Thanks for the help. It's working! I still find it to be a new
> concept. I haven't encountered storing loops in objects in any other
> languages. Can it even be done in other languages? Very novel, quite
> intriguing.
Hi David,
Thanks for the help. It's working! I still find it to be a new
concept. I haven't encountered storing loops in objects in any other
languages. Can it even be done in other languages? Very novel, quite
intriguing.
Thanks again,
Vivek
On Thu, Apr 29, 2010 at 3:44 PM, David M Smith
wrote
[This relates to the foreach function in library(foreach)]
Vivek,
In the %dopar% example, the assignments are being made into "child" R
sessions in parallel. foreach is generally pretty good about detecting
variables you reference in the parallel loops and making sure the
objects are copied over
Vivek Ayer wrote:
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)
}
... and which package are these functions in?
__
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
objec
5 matches
Mail list logo