Closed asmlgkj closed 2 years ago
Hi. Exactly what is the question? I'm not sure I understand
thanks a lot, for example, many files as input, and deal with parallely, will it return as input order?
I see.
The parallelly package itself does not have any, so called, map-reduce function. It is used to create a cluster of parallel workers, which then can take on tasks.
Sending tasks to the parallel workers can be done by, for instance, parLapply()
of the parallel package. y <- parLapply(x, ...)
, just like y <- lapply(x, ...)
, guarantees to return the results in the same order as the input (x
). This is true for all map-reduce functions I'm aware of, e.g. mclapply()
of the parallel package, future_lapply()
of the future.apply package, map()
of the purrr package, future_map()
of the furrr package, y <- foreach(...) %dopar% { ... }
of the foreach package, bplapply()
of the Bioconductor package, pblapply()
of the pbapply package, and so on. So, you can count on getting the results in the same order as your input when you use map-reduce functions in R.
PS. It is of course possible to create functions that does not respect the input order, but I'm not aware of anyone on CRAN or Bioconductor. I think this is, because they would not be very useful.
Thank you very much for your professional answer, you not only answered my question, but also expanded on it, you are a very nice person, so to summarize, as you said, all results are in the same order of output as the input, right?
Correct. Your welcome
Thanks a lot. is the result of parallelly orderly?