yihui / printr

Some (magical) printing methods for knitr
https://yihui.org/printr/
118 stars 24 forks source link

print.summary.lm method #13

Open bquast opened 8 years ago

bquast commented 8 years ago

Hi,

A print.summary.lm method would be amazing.

I am using summary(x)$coef right now, which also works nicely, just as with kable but much cleaner!

However, eventually there might be value in creating a specific method method such that you could simple enter:

<<model1>>=
summary(lm(y ~ X, data=df))
@

Which would then print a formatted table.

Thanks!

yihui commented 8 years ago

This should be simple to implement. Do you want to do it yourself and submit a pull request?

bquast commented 8 years ago

I can definitely try. It would be even better if this output table could be linked to the print of lm. That way we could just do this:

<<model1>>=
lm(y ~ X)
@

Which would be truely beautiful.

Thought there doesn't seem to be a print method for lm. Would there be any way of doing this?

yihui commented 8 years ago

There is a print method for lm; see methods(print) and getS3method('print', 'lm'). What you want to do in the PR is the knit_print methods for lm and summary.lm.

bquast commented 8 years ago

Okay, I'm going to have a look at this right, I do feel a bit out of my depth tbh.

bquast commented 8 years ago

pull request here:

https://github.com/yihui/printr/pull/14