Linked Questions

Popular Questions

For the purpose of publishing I often need both a PDF and a HTML version of my work including regression tables and I want to use R Markdown. For PDF the stargazer and the texreg packages produce wonderful tables. Now trying to generate an equally attractive HTML output I'm facing different issues.

  1. Both methods for HTML output are lacking significance stars in the notes. As they are automatically generated I don't know how to escape them. (I think this might be a minor problem and therefore I didn't want to split it into seperate questions.) Note: Sub-question has been answered here.

  2. Before creating the definite output I often have to change my data or do some formatting. I find it quite annoying to always flip-flop the options between type='html' to type='pdf'manually. I wonder if there might be a more feasible way to combine the html/pdf output , e.g. a case-to-case switch in texreg / stargazer with a tidy output?

I tried the promising pander-solution, but it seems not to be working anymore since 2014. Also pixiedust ist not very satisfying, it's becoming somewhat manual at the end and not exactly what I want. An other example seems to refer only to normal tables.

Any help is extremely appreciated, thanks!

Here is a summary of my attempts for knitr in HTML and PDF:

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```{r table, results = "asis"}
lm1 <- lm(prestige ~ income + education, data=Duncan)

## html
# stargazer
stargazer(lm1, type="html", notes="stargazer html")
# htmlreg
htmlreg(lm1, custom.note="%stars. htmlreg")

## pdf/latex
# stargazer
stargazer(lm1, notes="stargazer latex")
# texreg
texreg::texreg(list(lm1), custom.note="%stars. texreg")

# pixiedust
dust(lm1, caption = "pixiedust")

# pander
lm1_table <- mtable(lm1)
# pander(lm1_table, style="rmarkdown") # not working

Related Questions