nutterb / pixiedust

Tables So Beautifully Fine-Tuned You Will Believe It's Magic.
179 stars 18 forks source link

Sanitize latex values prior to rendering #51

Closed nutterb closed 8 years ago

nutterb commented 8 years ago

The underscore inlevel_detail below is causing the PDF to fail to render. The values column should be run through Hmisc::latexTranslate prior to putting them into the table. Preferably immediately before constructing the cells, but it should be okay any time after rounding and apply fn.

fit <- lm(mpg ~ am + wt + qsec + gear, data = mtcars)

dust(fit, descriptors = c("label", "level_detail"))

  label level_detail   estimate std.error  statistic   p.value
1  <NA>         <NA> 10.1904206 8.1814049  1.2455588 0.2236275
2    am               3.0826435 1.7785484  1.7332356  0.094462
3    wt              -3.9281622 0.7287665  -5.390152  1.07e-05
4  qsec               1.2217766 0.2953235  4.1370792 0.0003077
5  gear              -0.1414032 1.0103697 -0.1399519 0.8897368