我创建了一个在值框中显示值的闪亮应用。这些值应该与相应的货币($或€或£)一起显示,但是,只显示$ -sign。
MWE看起来像这样:
library(shinydashboard)
library(shiny)
ui <- dashboardPage(
dashboardHeader(title = "MWE"),
dashboardSidebar(),
dashboardBody(
fluidRow(
valueBox(value = paste0(sprintf("%.2f", 123.14), "$"),
subtitle = "This works good:",
color = "green"),
valueBox(value = paste0(sprintf("%.2f", 123.14), "€"),
subtitle = "This does not work:",
color = "red")
)
)
)
server <- function(input, output) {
}
shinyApp(ui, server)
有什么想法吗?
答案 0 :(得分:3)
您好,您可以使用以下的€(€
甚至€
)HTML代码。您还可以使用FontAwesome icons:
library(shinydashboard)
library(shiny)
ui <- dashboardPage(
dashboardHeader(title = "MWE"),
dashboardSidebar(),
dashboardBody(
fluidRow(
valueBox(value = paste0(sprintf("%.2f", 123.14), "$"), icon = icon("dollar"),
subtitle = "This works good:",
color = "green"),
valueBox(value = HTML(paste0(sprintf("%.2f", 123.14), "€")), icon = icon("euro"),
subtitle = "This does not work:",
color = "red")
)
)
)
server <- function(input, output) {
}
shinyApp(ui, server)