In an rmarkdown document, I'm creating a Latex table of regression coefficients with standard errors to compare several regression models in a single table. I'd like to vertically align the coefficients for each model so that the decimal points of the coefficients line up vertically down a column.
I'm using texreg to create the table. The coefficients aren't decimal-aligned by default (instead, each string is centered within its column) and I'm looking for a way to get the coefficents decimal-aligned. I'm not wedded to texreg, so if you have a solution using xtable, pander, stargazer or any other method, I'd be interested in that as well. Ideally, I'd like a solution that can be implemented programmatically within the rmarkdown document, rather than tweaking the latex markup after rendering the document into a .tex file.
As a bonus, I'd also like to be able to put line breaks in table headings. For example, in texreg you can use the custom.model.names argument to set the column names for each regression model. In the example below, I'd like to have "Add Horsepower and AM" split into two lines so that the column doesn't need to be so wide. I tried "Add Horsepower \newline and AM" but that just adds "ewline" to the final column header and the "\n" is ignored.
Here's a reproducible example:
---
title: "Regression Table"
author: "eipi10"
date: "August 15, 2016"
header-includes:
- \usepackage{dcolumn}
output: pdf_document
---
```{r, echo=FALSE, message=FALSE, results="asis"}
library(texreg)
m1 = glm(mpg ~ wt + factor(cyl), data=mtcars)
m2 = glm(mpg ~ wt + factor(cyl) + hp + factor(am), data=mtcars)
texreg(list(m1,m2),
single.row=TRUE,
custom.model.names=c("Base Model", "Add Horsepower and AM"),
custom.coef.names=c("Intercept", "Weight","Cyl: 6", "Cyl: 8", "Horsepower","AM: 1"))
```
And here's what the output table looks like:

