Skip to content

Recommend to modify the README #48

@nihaoWX

Description

@nihaoWX

The original readme had the following code example.

library(doParallel)
registerDoParallel(3)
mod_list2 <- foreach(dat=dat_list) %dopar% {
    lm(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width, data=dat)
}

stopImplicitCluster()

In Windows, writing code this way will cause a residual "R for Windows front-end" process to appear in Task Manager after the code finishes running, thus consuming RAM. The following method can avoid this situation.

library(doParallel)
cl <- makeCluster(3)
registerDoParallel(cl)
mod_list2 <- foreach(dat=dat_list) %dopar% {
    lm(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width, data=dat)
}
stopCluster(cl)
rm(cl)
gc()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions