r - texreg output with RStudio and rmarkdown -


i have question seems simple , fundamental can't find solution online. how make knitr (or pandoc) evaluate output given texreg functions?

a minimal example:

my entire .rmd file code:

--- title: "test texreg" output: pdf_document date: "january 27, 2016" ---  ```{r} library(texreg) texreg(list(lm(speed~dist,data=cars))) ``` 

when click knit pdf (or knit html or knit word) latex code table each line starts 2 pound symbols, i.e. r output texreg() function if had run @ console. have same issue if use htmlreg()

i assume have put function call somewhere else? can't seem figure out...

this question (r markdown "texreg") seems ask exact same question answer unhelpful me.

i not sure if elegant solution problem did discover a solution: put call texreg() inline r block so:

```{r} library(texreg) ```  `r texreg(list(lm(speed~dist,data=cars)))` 

this produces latex output in such way pandoc , identify produce latex table.

i happy accept more informed answers if come along.

edit:

another option: add results="asis" code chunk header. tried error prevented me seeing correctly formatted table , consequently didn't realize had stumbled upon solution.


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -