summarytools icon indicating copy to clipboard operation
summarytools copied to clipboard

Winword output suggestion

Open spedygiorgio opened this issue 6 years ago • 5 comments

Thanks again for your great package. Is it possible to add some suggestion on how to render the output in word or html using rmarkdown in RStudio? Best

spedygiorgio avatar Feb 21 '18 21:02 spedygiorgio

You're welcome! :)

I'll try to find some time to do so, but meanwhile I'd suggest taking a look at the source (.Rmd) files in the repo's vignettes folder, along with the rendered results (for which you'll find links at the top of the main page).

Cheers

dcomtois avatar Feb 22 '18 04:02 dcomtois

I finally (a year later, sorry!) explored a bit more the generation of Word documents from .Rmd docs. It seems that the recommendations from the vignette also apply to these, minus the ones using "html rendering". I added a comment to this effect at the end of the vignette. If you've found useful combinations of options, feel free to share them here and I'll include them in the next release of the package/vignette.

dcomtois avatar Feb 20 '19 20:02 dcomtois

Cool I will check and tell you

spedygiorgio avatar Feb 21 '19 19:02 spedygiorgio

html solution...

ui <- fluidPage(
      downloadButton('downloadReport')
    )


server <- function(input, output, session) {
  
  output$downloadReport <- downloadHandler(
    "summary table.html",
    function(file) {
      
      file_location <- "~/temp_table.html"
      
      print(summarytools::dfSummary(iris), file = file_location)
      
      file_object = readLines(file_location)
      file.remove(file_location)
      
      writeLines(file_object, file)
    }
  )
}

shinyApp(ui, server)

Anyone have a solution that doesn't involve writing and reading?

tsolloway avatar May 21 '19 04:05 tsolloway

Just some reference links... if it can help!

https://bookdown.org/yihui/rmarkdown/word-document.html

https://rmarkdown.rstudio.com/formats.html

dcomtois avatar Dec 28 '20 03:12 dcomtois