0

I'm converting an R DT table to an html widget.

The widgets have the annoying carriage return symbols. Example of carriage return issue:

Example of carriage return issue

The dataframe is all_p_22

My code:

library(htmlwidgets)
library(DT)

tab10a <- datatable(all_p_22,
                    filter = 'top',
                    options = list(
                      dom = "Bfrtip",
                      pageLength = 120,
                      autoWidth = TRUE,
                      buttons = c("csv","excel")),
                    rownames = FALSE,
                    caption = htmltools::tags$caption(style = 'caption-side: top; text-align: center; color:black; font-size:150%;',
                                                      'Table 10a: Overall Legislative Assembly result by party'),
                    class = 'cell-border stripe',
                    extensions = c("Buttons","Responsive"))

tab10a1 <- tab10a %>% 
  formatRound("Sum Votes",
              digits = 0,
              interval = 3,
              mark = ",") %>% 
  formatRound("Per cent",
              digits = 2,
              mark = ",")

saveWidget(tab10a1,"tab10a.html") 

Tried minor fixes such as removing buttons but had no effect.

SternK
  • 11,649
  • 22
  • 32
  • 46
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jan 09 '23 at 03:05
  • I haven't this issue, all works nice – manro Jan 09 '23 at 21:10

0 Answers0