相关疑难解决方法(0)

并行运行RSelenium

我将如何RSelenium并行运行?

以下是rvest并行使用的示例

library(RSelenium)
library(rvest)
library(magrittr)
library(foreach)
library(doParallel)

URLsPar <- c("http://www.example.com/", "http://s5.tinypic.com/n392s6_th.jpg", "http://s5.tinypic.com/jl1jex_th.jpg",
         "http://s6.tinypic.com/16abj1s_th.jpg", "http://s6.tinypic.com/2ymvpqa_th.jpg")

(detectCores() - 1) %>%  makeCluster %>% registerDoParallel

ws <- foreach(x = 1:length(URLsPar), .packages = c("rvest", "magrittr", "RSelenium"))  %dopar%  {
      URLsPar[x] %>% read_html %>% as("character")}

stopImplicitCluster()
Run Code Online (Sandbox Code Playgroud)

r rselenium doparallel

8
推荐指数
1
解决办法
1014
查看次数

标签 统计

doparallel ×1

r ×1

rselenium ×1