[Rd] step() in sink() and Sweave()

From: Jari Oksanen <jarioksa_at_sun3.oulu.fi>
Date: Wed, 09 May 2007 08:10:22 +0000

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 +


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:


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

Jari Oksanen <jarioksa_at_cc.oulu.fi>

R-devel_at_r-project.org mailing list
Received on Wed 09 May 2007 - 08:16:48 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 13 Jun 2007 - 14:34:42 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.