Dear Developers, This change also just bit me whilst updating Sweave documents for some computer classes.
Is there a work-around that can be employed so that we get both the message() bits and the print() bits in the same place for our Sweave files? If not, is there any point in filing this as a bug in R? I see there have been no (public) responses to Jari's email, yet the change is rather annoying, and I do not see the rationale for "printing" different parts of the output from step() in two different ways. All the best, Gav On Wed, 2007-05-09 at 08:10 +0000, Jari Oksanen wrote: > Dear developers, > > I just noticed that step() function currently prints the current model > using message(), but the resulting model using print(). The relevant > commands within the step() body are: > > if (trace) message("Start: AIC=", format(round(bAIC, 2)), "\n", > cut.string(deparse(as.vector(formula(fit)))), "\n") > > (with example() output:) > Start: AIC=190.69 > Fertility ~ Agriculture + Examination + Education + Catholic + > Infant.Mortality > > And later: > > if (trace) print(aod[o, ]) > > (with example() output:) > > Df Sum of Sq RSS AIC > - Examination 1 53.0 2158.1 189.9 > <none> 2105.0 190.7 > - Agriculture 1 307.7 2412.8 195.1 > - Infant.Mortality 1 408.8 2513.8 197.0 > - Catholic 1 447.7 2552.8 197.8 > - Education 1 1162.6 3267.6 209.4 > > This is a nuisance if you want to divert output to a file with sink() or > use step() in Sweave: the header and the table go to different places, > and without message() part the print() part is crippled. It may be that > there is some way to avoid this, but obviously that needs some degree of > acrobatic R skills. > > An example of the behaviour: > > sink(tempfile()) > example(step) > sink() > > I assueme that the behaviour is intentional but searching NEWS did not > give any information or reasoning. Would it be sensible to go back to > the old behaviour? I found some Swoven files from R 2.4.0 that still put > both parts of the output to the same place. For the sake of Sweave and > sink, I'd prefer the one place to be stdout instead of stderr. > > Best wishes, Jari Oksanen -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel