Hi Everyone, I want to replace the following for loop with an "apply" type function to (possibly) speed up the process.
# The for loop I want to replace x <- numeric(10) for(i in 2:10) x[i] <- x[i-1]+1 x To give you some more background, I am running a Metropolis Hastings MCMC chain with k parameters. So, if "x" represents the sample from the chain, the ith row (representing the ith iteration) depends on the (i-1)th row. Thanks in advance, Ritwik Sinha Graduate Student Epidemiology and Biostatistics Case Western Reserve University [EMAIL PROTECTED] | +12163682366 | http://darwin.cwru.edu/~rsinha ______________________________________________ R-help@stat.math.ethz.ch 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.