Elise_351995
Elise_351995

Reputation: 63

Decimal issues in a data table in RenderTable Shiny

I build a data table and rounded the values to two decimals, the result is good in RStudio.

But in my shiny app, there were zeros added:

enter image description here

I would like to remove these zeros but I didn't find how. How can I obtain this such that it looks similar to RStudio?

Upvotes: 1

Views: 605

Answers (1)

Ronak Shah
Ronak Shah

Reputation: 389275

You can use formatRound function.

library(DT)
datatable(df) %>% formatRound(c("a", "b"), digits=2)

replace c("a", "b") with the actual column names in your data.

Upvotes: 1

Related Questions