有没有一种方法可以放大slideInput来提高R Shiny的精度?

时间:2020-11-05 18:12:11

标签: r shiny

让我们假设我的min为0,而我的max为100,000,000,000。我需要精确到1。sliderInput如何实现?

1 个答案:

答案 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)

app

此解决方案的一个问题是您可以将值设置为0到99 999 999 999或199 999 999 999 ...