dcomtois / summarytools

R Package to Quickly and Neatly Summarize Data
504 stars 77 forks source link

[Feature Request] kableExtra integration or coloring functionality #96

Closed RickPack closed 4 years ago

RickPack commented 4 years ago

Might tables produced by summarytools be modifiable by kableExtra?

In particular, I am hoping to color cells by formula. kableExtra offers the _cellspec function for that purpose per this webpage.

That webpage also indicates:

Since the structure of kable is relatively simple, it shouldn’t be too difficult to convert HTML or LaTeX tables generated by other packages to a kable object and then use kableExtra to modify the outputs. If you are a package author, feel free to reach out to me and we can collaborate.

dcomtois commented 4 years ago

I'm not familiar with kableExtra, but I think it should work for freq() and descr() outputs after applying the tb() function.

iris %>% descr() %>% tb() %>% kable() %>% kable_styling()

For ctable() and dfSummary() outputs, I'm not sure about the feasibility though. I'll try and have a look at it when I get a chance.

RickPack commented 4 years ago

Success! Thank you, Dominic. I primarily wanted to do this in my stby() usage.