Change the separator in the button extension

Viewed 113

I use the R package DT as R interface to DataTables.

How can I adjust the "Buttons extension" in order to use a semicolon instead of a coma as separator when exporting to csv/ Excel?

library(DT)
m = cbind(matrix(rnorm(60, 1e5, 1e6), 20), runif(20), rnorm(20, 100))
m[, 1:3] = round(m[, 1:3])
m[, 4:5] = round(m[, 4:5], 7)
colnames(m) = head(LETTERS, ncol(m))

datatable(
  m, extensions = 'Buttons', options = list(
    dom = 'Bfrtip',
    buttons = c('copy', 'csv', 'excel')
  )
)
1 Answers
datatable(
  m, extensions = 'Buttons', options = list(
    dom = 'Bfrtip',
    buttons = list(
      'copy', 
      'excel', 
      list(
        extend = 'csv', 
        fieldSeparator = ';'
      )
    )
  )
)
Related