让我们假设我的min
为0,而我的max
为100,000,000,000。我需要精确到1。sliderInput
如何实现?
答案 0 :(得分:1)
您的鼠标(或手指)不够精确,无法在一个滑块中实现此功能,但是正如@starja所建议的,您可以使用多个鼠标。
ui <- fluidPage(
mainPanel(
sliderInput("billions", "Billions", min = 0, max = 10^11 - 10^9, value = 0, step = 10^9, width = 1000 ),
sliderInput("millions", "Millions", min = 0, max = 10^9 - 10^6, value = 0, step = 10^6, width = 1000 ),
sliderInput("thousands", "Thousands", min = 0, max = 10^6 - 1000, value = 0, step = 10^3, width = 1000 ),
sliderInput("units", "Units", min = 0, max = 10^3-1, value = 0, step = 1, width = 1000 ),
verbatimTextOutput("result")
)
)
server <- function(input, output, session) {
options(scipen=999)
output$result <- renderPrint(input$billions + input$millions + input$thousands + input$units)
}
shinyApp(ui, server)
此解决方案的一个问题是您可以将值设置为0到99 999 999 999或199 999 999 999 ...