You're having a problem passing the arguments to the worker function properly. I believe you need a nested loop over "centers" and "nstart", and you should also export "iris.cluster" to the cluster workers since you don't want to iterate over it. Perhaps this is closer to what you want to do:
library(parallel)
data(iris)
iris.cluster <- iris[,-5]
cl <- makeCluster(detectCores())
clusterExport(cl, 'iris.cluster')
worker <- function(centers, nstart) {
kmeans(iris.cluster, centers=centers, nstart=nstart)
}
myiter <- 2
nstarts <- rep(25, myiter)
nclus <- 2:5
g <- expand.grid(nstarts=nstarts, nclus=nclus)
results <- clusterMap(cl, worker, centers=g$nclus, nstart=g$nstarts)
stopCluster(cl)
This uses the "expand.grid" function to generate the arguments for a total of length(nstarts) * length(nclus)
tasks.