I have coded an MCMC sampler using Rcpp
(specifically, RcppArmadillo
). I would like my sampler to print periodic status messages to the R console, but the messages appear all at once when the sampler terminates. The output statement is :
Rcout << "Progress => "
<< double(iterations) / double(maxit) * 100
<< "%"
<< std::endl;
Can this code be augmented so that its output appears on the R console immediately?
R version: 2.14.1
platform: Darwin 9.8.0
Rcpp version: 0.9.10