kRazzy R
kRazzy R

Reputation: 1589

how should I change the position of action button to the bottom?

this is my 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")
>                    
>        )    )

This is my server.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 })


})

This is a screen shot of my current out put enter image description here

I want to know how to bring the analyse(Action button) to position below range slider. And how should I have all of them in one alignment. As you can see the slider input is way off along with analyse button. I am new to R and shiny any help/resource is appreciated Thanks

Upvotes: 1

Views: 2176

Answers (1)

ulfelder
ulfelder

Reputation: 5335

I think the problem is coming from the column() you try start before the call to sliderInput(). The code below gave me a set of input selectors of equal width with the action button at the bottom:

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")                    

))

This set-up is also a good candidate for sidebarLayout().

Upvotes: 2

Related Questions