All,

 

I would like to use the assign to save some data from a calculation
within a foreach loop.  Below is a contrived example where I cannot get
output_1 ... output_100 to show up in my list when I do ls().  I have
tried different combinations of pos and envir without anything showing
up. 

 

    out <- foreach(d=1:100, .combine=rbind) %dopar% {

        x <- 10 * d

        assign(paste("output_", d, sep=""), x, envir = .GlobalEnv)

    }

    

    out

    ls()

    

I am using doSNOW and here is the additional setup code needed to run
the above example if you don't already have a parallel backend
configured:

 

library(foreach)

library(doSNOW)

cl <- makeCluster(rep("localhost",8), type = "SOCK")

registerDoSNOW(cl)

 

Thanks in advance for any help.  Roger

 

 
***************************************************************

This message is for the named person's use only. It may\...{{dropped:18}}

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to