I am working with an R Markdown file that we need to be able to knit both to pdf and Word (for a co-author). We also have regression tables generated in stargazer that, due to the size of the data, are computed separately and two files are created: regression_table.tex and regression_table.html.
When knitting to pdf, I can easily add the table to R Markdown with the latex command \input.
\input{"regression_table.tex"}
To knit to Word, though, I've not been able to find an easy equivalent to \input for the html file. One option is to manually insert the html table file within Word and that works fine as a low-tech back-up option. Another partial solution uses modified code from a related question. With the code chunk below, I am able to knit to html and then import the html document to Word. This maintains the table format but other formatting, like headers and figures, gets messed up.
```{r echo = FALSE, results = 'asis'}
tmp <- paste(readLines(here("regression_table.html")), collapse="\n")
cat(tmp)
```
Is there a simple equivalent to \input for an html table in a file that works well with knitting to Word?