在下面的shiny
应用程序的DT::datatable()
中,我找到了如何在表中添加“千”标记)(.),但我想去掉小数。
library(shiny)
library(shinydashboard)
library(DT)
## app.R ##
library(shiny)
library(shinydashboard)
library(DT)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
),
dashboardBody(
dataTableOutput("table")
)
)
server <- function(input, output) {
iris<-iris[,1:4]*100000
output$table <- renderDataTable({
datatable(iris) %>%
formatCurrency(columns = c("Sepal.Length","Sepal.Width","Petal.Length","Petal.Width"), currency = "", interval = 3, mark = ".") %>%
formatStyle(
columns = c("Sepal.Length")
) })
}
shinyApp(ui, server)
1条答案
按热度按时间db2dz4w81#
只需将
digits=0
添加到formatCurrency()
即可。