[R] step in Sweave
jarioksa at sun3.oulu.fi
Tue May 15 10:20:50 CEST 2007
I have a Sweave document which demonstrates the usage of step()
function. With current R version 2.5.0 the step() function was changed
so that the heading of trace=TRUE output for each model is printed using
message("\nStep: AIC=", format(round(bAIC, 2)),
And the actual models concerned with true blue print():
The problem here is that these parts go to different places: message()
prints on the terminal where you run Sweave (or to stderr()), and
print() prints to the result file (like it should do). Therefore the
result file is without the step header, and looks bad.
I believe there must be a way of getting all output to the result file,
but I haven't yet found that way. Can anybody here show me the light.
I had a similar problem when sink()ing the output to a file, but there I
could find a solution (clumsy, but a solution: you need to double your
An optimal solution would be to change the function back to the old
behaviour where all trace output is printed without message(). I bet
that won't happen, though.
Cheers, Jari Oksanen
Jari Oksanen <jarioksa at cc.oulu.fi>
More information about the R-help