Conversation
library(printr)
lm(speed ~ dist, data=cars)(Intercept) 8.2839056 0.8743845 9.473985 0 Note that it's GFM that doesn't render this table well, it works fine in R |
|
For the LaTeX problem, did you have |
R/table.R
Outdated
| #' @export | ||
| knit_print.lm = function(x, options, ...) { | ||
| res = paste(c( | ||
| '', '', kable(summary(x)$coef, options$render.args$kable$format, ...) |
There was a problem hiding this comment.
I'd suggest a different form of printing, e.g. print out the regression equation, instead of the identical output as the summary.lm method.
There was a problem hiding this comment.
That is a good idea, I wasn't sure what to do with the summary one but that makes sense. I'll update this now.
There was a problem hiding this comment.
Let me know what you think about this.
There was a problem hiding this comment.
I mean lm gives the equation of the form dist = ? + ? speed (instead of the R call), and summary.lm gives the coefficient matrix.
|
I'm using LyX which I'm quite sure does this when rendering using pdflatex, it also occurs when using LuaTeX. This may be related, when I produce a kable in an ERT in standard text it always works fine, but the if the first number is negative (i.e. coefficient of the intercept) and I embed it in a |
There is still a slight problem in that it prints
as:
in LaTeX documents