I have a loop that iterates from 2 to a specified value(i.e. ,columnCount). The value of i is crucial as all computation that takes place inside the loop is dependent on the value of i.
Loop snippet:
> x1=runif(900000,9999,90999)
> x2=runif(900000,0,9)
> x3=runif(900000,5000,80000)
> y=rep(0:1,450000)
> data=data.frame(y,x1,x2,x3)
> dim(data)
[1] 900000 4
> columnCount = ncol(data)
> yVar = names(data[1])
for (i in 2:columnCount) {
xVar[i] = names(data[i])
result <- smbinning(df=data,y=yVar,x=xVar[i],p=0.05)
}
Note: Y column is always constant,while x columns iterates by 1 in every step(Actual data frame has 250+ columns).How do i translate this to so that I can use:
library(foreach)
library(doParallel)
foreach(icount(iters)) %dopar% {