I need to display the data in my table for 3 decimal places but it turns out that it doesn't display 3 decimal places when I run my application. Though when I try to interact with it it displays 3 decimal places.
Is there any way to do this?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With