Hi R people, I have an R script Fit12_for_stack.R that calls rstan’s stan(). When I run the code in an interactive R session, I see warning messages from stan() about divergent transitions, but when I run the code on the command line with “Rscript Fit12_for_stack.R”, I don’t see stan() warning messages. How can I run the code on the command line and still see stan() warning messages?
From the post How to save all console output to file in R? <http://stackoverflow.com/questions/7096989/how-to-save-all-console-output-to-file-in-r>, I tried adding con <- file("test.log") sink(con, append=TRUE) sink(con, append=TRUE, type="message") to the top of Fit12_for_stack.R, but test.log again showed output, without stan() warning messages. Fit12_for_stack.R and a file it uses, try8.stan, are attached. Thanks, Qian P.S. If you prefer responding via StackExchange, I also posted there: http://stackoverflow.com/questions/39134667/how-can-i-capture-warning-messages-from-rstan-r-packages-stan-function-when <http://stackoverflow.com/questions/39134667/how-can-i-capture-warning-messages-from-rstan-r-packages-stan-function-when>. ______________________________________________ R-help@r-project.org 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.