We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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
The text was updated successfully, but these errors were encountered:
NA
Sorry, something went wrong.
No branches or pull requests
According to ?parCapply:
parRapply and parCapply always return a vector.
This appears not to be the case in the following minimal reproducible example:
+ ind <- x[1]
+ y <- x[-1]
+ if(ind==1){
+ r1 <- sum(y)
+ }else{
+ r1 <- logical(0)
+ }
+ return(unlist(as.numeric(c(ind,r1))))
+ })
[[1]]
[1] 1
[[2]]
[1] 6
[[3]]
[1] 1
[[4]]
[1] 6
[[5]]
[1] 0
[[6]]
[1] 1 6
[1] "list"
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
The text was updated successfully, but these errors were encountered: