On Thu, 22 Mar 2007, ivo welch wrote: > dear R experts: > > I am often struggling with a desire of wanting to change the basic > output that R prints. > > For example, a year ago, I wanted to add the mean to the summary() > statement, and eventually got help from friendly souls who showed me > how to copy the summary() routine and then modify it. > > now I would like to abbrev some of the output from summary(lm()). For > example, I want to eliminate the "Residuals" output. I also am not > quite sure why "Call:" is followed by a new line rather than just with > a continuation of the model itself. I also wonder why the word > "Coefficients" seems to consume a line without being particularly > helpful. I wonder if "Coef" could appear before "Estimate Std. Error" > on the same line. All these are changes that would allow me to see > more information on the same page. >
This is not what summary( lm(...) ) does. It is what print( summary( lm(...) ) ) does, (albeit) often automatically. So you need to look at stats:::print.summary.lm and provide your own version. > I do know that I can copy the functions themselves, if I can find > them, and replace them myself. However, this means that future > versions of R may make changes that I may miss completely. Its a > solution, yes. You need to operate on the value returned by summary.lm. Changes that occur 'under the hood' won't affect you. > > However, my first question is---for summary(lm()), would it make sense > to have more options that control the output? At least to suppress > the printing of the distribution of the residuals? > No. As suggested above, summary(lm(...)) prints nothing. It should not be too hard to put together your own version of print.summary.lm and invoke it when you want your customized output. > A long-term solution, which is easy to suggest for me given that I do > not have to do any work to implement it, would be to allow some > templates that specify how output should be formatted. R would first > load the system templates, and thereafter any templates that the user > specifies (has overridden). The R functions would then work according > to the current template. Talking is easy; Walking is hard, of > course. Just a suggestion... > > Regards, > > /iaw > > ______________________________________________ > [email protected] mailing list > 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. > Charles C. Berry (858) 534-2098 Dept of Family/Preventive Medicine E mailto:[EMAIL PROTECTED] UC San Diego http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0901 ______________________________________________ [email protected] mailing list 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.
