3
Is there any way to show the numbers as currency (R$), including thousands and cents separator, in the progress bars of Shiny’s shinyWidgets package? I’m trying to run some code, but they all convert numbers to strings, so Shiny can’t calculate.
In the example, I would like it to stay so:
R$1,000,000,70/R$5,000,000,29
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
progressBar(id = "pb1", value = 1000000.70,
total = 5000000.29, status = "info", display_pct = TRUE, striped = TRUE,
title = "DONATION"),
progressBar(id = "pb2", value = as.numeric(1000000.70, options(scipen=999)),
total = as.numeric(5000000.29, options(scipen=999), status = "info", display_pct = TRUE, striped = TRUE,
title = "DONATION")
)
)
server <- function(input, output) {}
shinyApp(ui = ui, server = server)
I don’t usually use Shiny, but a
paste0
along with the functionformat
before the values would not solve?– Alexandre Sanches
Hello! The Paste (and paste0) function convert numeric entries into string. Thus, Shiny cannot calculate the ratio between the total value and the input and gives error. Thanks for the contribution, Alexandre.
– Jefferson Rodrigues