I am trying to run this loop but it keeps coming up with the following error:
'Error: no function to return from, jumping to top level' n.simul <- 1000 A <- {for(i in 1:12){{ nT <- rpois(n.simul, T[i]) nP <- rpois(n.simul, P[i]) nD <- rpois(n.simul, D[i]) nC <- rbinom(n.simul, nT, C[i]) Score <- (5*nT + 2*nC + 3*nP + 3*nD) } return(Score)}} My aim is to calculate nT, nP, nD and nC (which predicts the number of tries, penalties, drop goals and conversions scored in matches, which are simulated 1000 times which give 1000 scores) then to use these to calculate the Score using these and multiplying by a constant for teams 1 to 12. So i am expecting this to give me a 1000 x 12 matrix of simulated scores Please ask in any other information is required. Many Thanks -- View this message in context: http://r.789695.n4.nabble.com/Trouble-with-a-loop-tp4447271p4447271.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list 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.