Hi Everyone,

I have been working recently on a new package for building and printing LaTeX tables with multi-level row and column indices. It’s still in Beta and unregistered (for now, although I hope to register it officially in the very near future), but I would really appreciate any feedback.

It is designed for building all sorts of statistical tables in a very modular fashion and for quickly displaying them in the REPL or exporting them to LaTeX. It’s quite extensible, and I think the most important use cases will be for people who want to make their own custom tables, but I have implemented support for some basic regression tables, cross-tabulations, and summary statistics as proof-of-concept:

For example, it makes it extremely easy to put together regression tables:

```
julia> using StatsModels, GLM
julia> df = dataset("datasets", "attitude");
julia> m1 = lm(@formula( Rating ~ 1 + Raises ), df);
julia> m2 = lm(@formula( Rating ~ 1 + Raises + Learning), df);
julia> m3 = lm(@formula( Rating ~ 1 + Raises + Learning + Privileges), df);
julia> m4 = lm(@formula( Rating ~ 1 + Raises + Learning + Privileges
+ Complaints), df);
julia> m5 = lm(@formula( Rating ~ 1 + Raises + Learning + Privileges
+ Complaints + Critical), df);
julia> table = regtable(m1, m2, m3, m4, m5)
| (1) | (2) | (3) | (4) | (5)
-------------------------------------------------------------------
(Intercept) | 19.978* | 15.809 | 14.167 | 11.834 | 11.011
| (11.688) | (11.084) | (11.519) | (8.535) | (11.704)
Raises | 0.691*** | 0.379* | 0.352 | -0.026 | -0.033
| (0.179) | (0.217) | (0.224) | (0.184) | (0.202)
Learning | | 0.432** | 0.394* | 0.246 | 0.249
| | (0.193) | (0.204) | (0.154) | (0.160)
Privileges | | | 0.105 | -0.103 | -0.104
| | | (0.168) | (0.132) | (0.135)
Complaints | | | | 0.691*** | 0.692***
| | | | (0.146) | (0.149)
Critical | | | | | 0.015
| | | | | (0.147)
-------------------------------------------------------------------
N | 30 | 30 | 30 | 30 | 30
$R^2$ | 0.348 | 0.451 | 0.459 | 0.715 | 0.715
```

It is equally easy to group the columns according to some headings:

```
julia> grouped_table = regtable( "Group 1"=>(m1,m2,m3),
"Group 2"=>(m4, m5))
| Group 1 | Group 2
| (1) | (2) | (3) | (4) | (5)
------------------------------------------------------------------
(Intercept) | 19.978 | 15.809 | 14.167 | 11.834 | 11.011
| (11.688) | (11.084) | (11.519) | (8.535) | (11.704)
Raises | 0.691 | 0.379 | 0.352 | -0.026 | -0.033
| (0.179) | (0.217) | (0.224) | (0.184) | (0.202)
Learning | | 0.432 | 0.394 | 0.246 | 0.249
| | (0.193) | (0.204) | (0.154) | (0.160)
Privileges | | | 0.105 | -0.103 | -0.104
| | | (0.168) | (0.132) | (0.135)
Complaints | | | | 0.691 | 0.692
| | | | (0.146) | (0.149)
Critical | | | | | 0.015
| | | | | (0.147)
------------------------------------------------------------------
N | 30 | 30 | 30 | 30 | 30
$R^2$ | 0.348 | 0.451 | 0.459 | 0.715 | 0.715
```

When printing to latex, multi-column or multi-row groupings are automatically handled with latex `\multicolumn`

and `\multirow`

environments. `TexTables.jl`

also supports tables of summary statistics and cross-tabulations, including grouped summary tables:

```
julia> using RDatasets
julia> df = dataset("datasets", "iris");
julia> c1 = summarize_by(df, :Species, [:SepalLength, :SepalWidth])
| | Obs | Mean | Std. Dev. | Min | Max
-------------------------------------------------------------------
setosa | SepalLength | 50 | 5.006 | 0.352 | 4.300 | 5.800
| SepalWidth | 50 | 3.428 | 0.379 | 2.300 | 4.400
-------------------------------------------------------------------
versicolor | SepalLength | 50 | 5.936 | 0.516 | 4.900 | 7.000
| SepalWidth | 50 | 2.770 | 0.314 | 2.000 | 3.400
-------------------------------------------------------------------
virginica | SepalLength | 50 | 6.588 | 0.636 | 4.900 | 7.900
| SepalWidth | 50 | 2.974 | 0.322 | 2.200 | 3.800
```

For more details, see the documentation in the README. Please let me know what you think. I’m very eager to make improvements to make this as useful as possible.