View source: R/input-noUiSlider.R
wNumbFormat | R Documentation |
Format numbers in noUiSliderInput
wNumbFormat(
decimals = NULL,
mark = NULL,
thousand = NULL,
prefix = NULL,
suffix = NULL,
negative = NULL
)
decimals |
The number of decimals to include in the result. Limited to 7. |
mark |
The decimal separator. Defaults to |
thousand |
Separator for large numbers. For example: |
prefix |
A string to prepend to the number. Use cases
include prefixing with money symbols such as |
suffix |
A number to append to a number. For example: |
negative |
The prefix for negative values. Defaults to |
a named list.
Performed via wNumb JavaScript library : https://refreshless.com/wnumb/.
if (interactive()) {
library( shiny )
library( shinyWidgets )
ui <- fluidPage(
tags$h3("Format numbers"),
tags$br(),
noUiSliderInput(
inputId = "form1",
min = 0, max = 10000,
value = 800,
format = wNumbFormat(decimals = 3,
thousand = ".",
suffix = " (US $)")
),
verbatimTextOutput(outputId = "res1"),
tags$br(),
noUiSliderInput(
inputId = "form2",
min = 1988, max = 2018,
value = 1988,
format = wNumbFormat(decimals = 0,
thousand = "",
prefix = "Year: ")
),
verbatimTextOutput(outputId = "res2"),
tags$br()
)
server <- function(input, output, session) {
output$res1 <- renderPrint(input$form1)
output$res2 <- renderPrint(input$form2)
}
shinyApp(ui, server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.