Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGZILLA #17807] parRapply and parCapply return a list in corner cases #6982

Open
github-actions bot opened this issue May 23, 2020 · 4 comments
Open

Comments

@github-actions
Copy link

According to ?parCapply:

parRapply and parCapply always return a vector.

This appears not to be the case in the following minimal reproducible example:

library(parallel)
nslaves <- 2
cl      <- makeCluster(nslaves)
X       <- matrix(2,nrow=3,ncol=4)
X       <- rbind(c(1,1,0,1),X)
tv <- parCapply(cl,X,FUN=function(x){

+ ind <- x[1]
+ y <- x[-1]
+ if(ind==1){
+ r1 <- sum(y)
+ }else{
+ r1 <- logical(0)
+ }
+ return(unlist(as.numeric(c(ind,r1))))
+ })

tv

[[1]]
[1] 1

[[2]]
[1] 6

[[3]]
[1] 1

[[4]]
[1] 6

[[5]]
[1] 0

[[6]]
[1] 1 6

class(tv)

[1] "list"

sessionInfo()

R version 4.0.0 (2020-04-24)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=Italian_Italy.1252 LC_CTYPE=Italian_Italy.1252
[3] LC_MONETARY=Italian_Italy.1252 LC_NUMERIC=C
[5] LC_TIME=Italian_Italy.1252

attached base packages:
[1] parallel stats graphics grDevices utils datasets
methods base

loaded via a namespace (and not attached):
[1] compiler_4.0.0

Kind regards

Simone


METADATA

  • Bug author - Simone Giannerini
  • Creation time - 2020-05-22 07:14:25 UTC
  • Bugzilla link
  • Status - UNCONFIRMED
  • Alias - None
  • Component - Low-level
  • Version - R 4.0.0
  • Hardware - All All
  • Importance - P5 major
  • Assignee - R-core
  • URL -
  • Modification time - 2020-05-22 07:46 UTC
@github-actions
Copy link
Author

NA


METADATA

  • Comment author - Simone Giannerini
  • Timestamp - 2020-09-12 09:07:05 UTC

@github-actions
Copy link
Author

NA


METADATA

  • Comment author - Sebastian Meyer
  • Timestamp - 2020-09-12 16:08:06 UTC

@github-actions
Copy link
Author

NA


METADATA

  • Comment author - Simone Giannerini
  • Timestamp - 2020-09-13 08:29:16 UTC

@github-actions
Copy link
Author

NA


METADATA

  • Comment author - Sebastian Meyer
  • Timestamp - 2020-09-13 20:04:06 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

0 participants