处理和优化 R 中的范围滑块

Handling and optimizing a range slider in R

如果你 运行 下面的脚本,你会得到一个代表虹膜数据的数据 table 和一个范围滑块,它给你的值大于和等于你的先前圆上的所选点滑块中的选择。我想要一个逻辑,当左滑块节点保持在 5,右滑块节点保持在 7 时,我希望数据显示为“= 和 5 以上”和“< 和等于 7”。但是这些值应该是动态的。同样对于滑块上的两个圆圈,有没有办法提供较小的三角形小部件。附上快照以供参考。谢谢,请帮忙。

#App
library(shiny)
library(shinydashboard)
library(dplyr)
library(scales)
library(DT)

#Declaring the UI
ui <- fluidPage(
titlePanel("Slider Test"),
fluidRow(
column(4,
         sliderInput("range", "Select the Name Similarity %",
                     min = 4, max = 8,
                     value = c(min,max) ))

),

# Create a new row for the table.
fluidRow(
DT::dataTableOutput("table")
)
)
#Declaring the Server
server <- function(input, output) {
output$table <- DT::renderDataTable(DT::datatable({
Prod_total1      <-  subset(iris, as.numeric(sub("%", "", 
iris$Sepal.Length)) >= input$range)
  Prod_total1
}))
}
shinyApp(ui, server)

为了在范围模式下访问 sliderInput 值,请使用 input$range[1] 访问第一个极端,使用 input$range[2] 访问第二个

#App
library(shiny)
library(shinydashboard)
library(dplyr)
library(scales)
library(DT)

#Declaring the UI
ui <- fluidPage(
  titlePanel("Slider Test"),
  fluidRow(
    column(4,
           sliderInput("range", "Select the Name Similarity %",
                       min = 4, max = 8,
                       value = c(min,max) ))

  ),

  # Create a new row for the table.
  fluidRow(
    DT::dataTableOutput("table")
  )
)




#Declaring the Server
server <- function(input, output) {
  output$table <- DT::renderDataTable(DT::datatable({
    iris[iris$Sepal.Length >= input$range[1] & iris$Sepal.Length <= input$range[2],]
  }))
}
shinyApp(ui, server)