Closed cecilesauder closed 5 years ago
Hi Cecile, thanks for your feedback. This has to do with css... Check out the following vignette which gives working examples:
https://cran.r-project.org/web/packages/summarytools/vignettes/Recommendations-rmarkdown.html
The line feeds are there (we can't put <br>
's inside a table cell per html specifications), there just needs to be a style element to tell the browser not to ignore them... Specifically, this is how summarytools does it: it includes this "chunk" in its css file (summarytools.css
):
.st-multiline {
white-space: pre;
}
... and the class "st-multiline" is given to dfSummary tables. If you look at the source html after for instance print(dfSummary(iris), file = "~/test.html")
, you'll see it.
See the vignette and this link for another explanation: https://stackoverflow.com/questions/10937218/how-to-show-multiline-text-in-a-table-cell
... and let me know how this goes!
Edit: I realize this can be tedious... I'll explore an avenue using the <pre>
tag as discussed in the Stack Overflow post, and I'll keep everyone posted.
Hi Dominic,
I solve the problem with what you specified in the vignette, I add the summarytools.css
file in the yaml and now it's work !
Thanks for your help :)
This problem was with the CRAN version of the package because with the dev-current version I couldn't render
my . Rmd.
I'm going to try again you new dev-current version today.
When I run
view(dfSummary(data))
in the console I get something like thisbut when I put
view(dfSummary(data), method = "render")
in my Rmd (html_output) , I get this :I think adding some
<br>
at the end each lines inStats / Values
andFreqs
to have the same result that in the Rstudio Viewer could be very good :)Thanks for your package !