I have a question that seems so simple and fundamental that I can't find the solution online. How do I make knitr (or Pandoc) evaluate the output given by the 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 I click Knit PDF (or Knit HTML or Knit Word) I get LaTeX code for the table but each line starts with two pound symbols, i.e. the r output from the texreg()
function as if I had run it at the console. I have the same issue if I use htmlreg()
I assume that I just have to put the function call somewhere else? I can't seem to figure it out...
This question (R markdown "texreg") seems to ask the exact same question but the answer is unhelpful to me.