r - Knitr kable() output not displayed correctly when there are parenthesis in column title -


i have linear model, want print coefficient table in knitr chunk inside r markdown file. produce html file r markdown file.

> model <- lm(speed ~ dist, cars) 

this coefficient table is not displayed correctly when place in {r results='asis'} knitr chunk. table displayed plain text in html page.

> kable(xtable(model))   |            |  estimate| std. error|  t value| pr(>|t|)| |:-----------|---------:|----------:|--------:|--------:| |(intercept) | 8.2839056|  0.8743845| 9.473985|        0| |dist        | 0.1655676|  0.0174945| 9.463990|        0| 

this coefficient table is displayed correctly when place in {r results='asis'} knitr chunk. table displayed html table in html page.

> kable(data.frame(xtable(model)))   |            |  estimate| std..error|  t.value| pr...t..| |:-----------|---------:|----------:|--------:|--------:| |(intercept) | 8.2839056|  0.8743845| 9.473985|        0| |dist        | 0.1655676|  0.0174945| 9.463990|        0| 


Comments

Popular posts from this blog

How to access named pipes using JavaScript in Firefox add-on? -

multithreading - OPAL (Open Phone Abstraction Library) Transport not terminated when reattaching thread? -

node.js - req param returns an empty array -