这是我的ui.r
> shinyUI(fluidPage(
> headerPanel(" UI demo "),
> #line below is to make a text input box
> textInput("text", label = h3("Enter search item 1"), value = "apple"),
> textInput("text", label = h3("Enter search item 2"), value = "google"),
> dateRangeInput("dates", label = h3("Date range")),
> column(4,
>
> # Copy the line below to make a slider range
> sliderInput("slider2", label = h3("Slider Range"), min = 0,
> max = 15000, value = 3000)
> ),
> br(),
> actionButton("action", label = "Analyse")
>
> ) )
这是我的服务器.R
shinyServer(function(input, output) {
# You can access the value of the widget with input$text, e.g.
output$value<-renderPrint({input$text})
# You can access the value of the widget with input$slider1, e.g.
output$value <- renderPrint({ input$dates })
# You can access the values of the second widget with input$slider2, e.g.
output$range <- renderPrint({ input$slider2 })
output$value <- renderPrint({ input$action })
})
我想知道如何将分析(动作按钮)置于范围滑块下方。我应该如何将它们全部放在一个对齐中。如您所见,滑块输入与分析按钮一起关闭。 我是R的新手并且闪亮任何帮助/资源都表示赞赏 感谢
答案 0 :(得分:2)
我认为问题来自于column()
,您在调用sliderInput()
之前尝试启动。下面的代码给了我一组宽度相等的输入选择器,底部有动作按钮:
shinyUI(fluidPage(
headerPanel(" UI demo "),
textInput("text", label = h3("Enter search item 1"), value = "apple"),
textInput("text", label = h3("Enter search item 2"), value = "google"),
dateRangeInput("dates", label = h3("Date range")),
sliderInput("slider2", label = h3("Slider Range"), min = 0, max = 15000, value = 3000),
br(),
actionButton("action", label = "Analyse")
))
此设置也是sidebarLayout()
的理想选择。