Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align decimal points in htmlreg #188

Open
jay-sf opened this issue Feb 22, 2022 · 2 comments
Open

Align decimal points in htmlreg #188

jay-sf opened this issue Feb 22, 2022 · 2 comments

Comments

@jay-sf
Copy link

jay-sf commented Feb 22, 2022

Hello,
I am surprised that no issue has been opened on this topic yet. I have been searching the internet for hours in vain for a straightforward solution to align regression coefficients in HTML tables to decimal places. In following image, the decimal points of the coefficients are not aligned.

enter image description here

Maybe I have overlooked it, but i can't find an option to align decimal points. An option align='decimal' or similar would be great, it should actually be the default behavior though.

It would be great if you could have a look at this!

Cheers

Desired outcome: Aligned coefficients.

MWE:

---
output: html_document
date: '2022-02-22'
---
```{r, results='asis'}
fit1 <- lm(Sepal.Length ~ . - Species, iris)
fit2 <- lm(Sepal.Length ~ ., iris)

library(texreg)
htmlreg(list(fit1, fit2), star.symbol='&#42;')

``` `

@leifeld
Copy link
Owner

leifeld commented Feb 22, 2022

When I wrote htmlreg, decimal point alignment wasn't possible. Now that I upgraded htmlreg to HTML5, there are several ways to achieve this, but I am not sure what the best way is. See here for an overview. It should ideally work well with the different compilation options available in knitr and RStudio with pandoc, be compatible with as many browsers as possible, and it should look somewhat parsimonious in the HTML code. If you have suggestions as to what works best and why, I'll be happy to look at them. Perhaps with a code example where you modify the htmlreg output and show what it looks like in some screenshots in different browsers and in RStudio-compiled documents.

@leifeld
Copy link
Owner

leifeld commented Mar 2, 2022

I have looked into various options. Apparently there is still no good solution even in HTML5. This solution looks most promising and is perhaps worth implementing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants