How to always display 3 decimal places in DataTables in R Shiny? [closed]
You can use DT::formatRound
function. It take list of columns and number of digits to render:
library(DT)set.seed(323)data.frame(x=runif(10), y=rnorm(10), z=rpois(10, 1)) %>% datatable() %>% formatRound(columns=c('x', 'y'), digits=3)
Just remember about using DT::renderDataTable
in the server function and DT::dataTableOutput
in the UI.