Dear all,
when I am running the code attached below, it seems that no results are
returned, only the predefined NAs. What mistake do I make?
Any comments and help is highly appreciated.
Thanks and best,
Martin
Simpar3 <- function(n1) {
L2distance <- matrix(NA, ncol=n1, nrow=n1)
data <- rnorm(n1)
diag(L2distance)=0
cl <- makeCluster(4)
registerDoParallel(cl)
foreach(j=1:n1) %dopar% {
library(np)
datj <- data[j]
for(k in j:n1) {
L2distance[j,k] <- k*datj
}
}
stopCluster(cl)
return(L2distance)
}
Res <- Simpar3(100)
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.