I have this code which is working

library("checkpoint")
library("gtrendsR")
library("doParallel")

cl<-makeCluster(4)
registerDoParallel(cl)
gconnect(usr = "em...@gmail.com", psw = "password", verbose = FALSE)

names <- c("apple","shit", "android", "rocks")
formula <- function(x){
x0 <- gtrends(x, res = "7d")
x1 <- x0[3]
x2 <- as.data.frame(x1)
x3 <- x2[1,2]return(x3)}
for( x in names)
{

   x5 <- rbind(x5,formula(x))
}

Now, I want to process this code with parallel processing, so I am using
foreach function

How can I do the same for foreach loop?

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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