2017-06-01 2 views
0

Ich versuche, ein Dropdown-und einige Radio-Tasten, die in einer Zeile in einer Box in einer Shiny R App sind. Siehe den folgenden Code.R Shiny Space Out Dropdown und Radiobuttons

box(
    title = "Title" 
    ,status = "primary" 
    ,div(style="display:inline-block",selectInput('crisis_type_top_10_imp_wors', 'Crisis', c("Composite", "Banking", 
                           "Currency", "Sovereign", 
                           "Sudden Stop"), width = "120px")) 
    ,div(style="display:inline-block",radioButtons("top_ten_normalisation_type_radio","Normalisation", 
                c("Global" = "Global", 
                 "Regional" = "Regional", 
                 "Own Country" = "Own Country") 
                ,inline=T)) 
    ,solidHeader = FALSE 
    ,collapsible = FALSE 
    ,dataTableOutput("topTen") 
    , height = 660 
    , width = 6 
    , align='ccc' 
) 

enter image description here

Antwort

1

Sie könnten es in Spalten strukturieren():

box(
    title = "Title" 
    ,status = "primary" 
    ,column(width = 2, 
    div(style="display:inline-block",selectInput('crisis_type_top_10_imp_wors', 'Crisis', c("Composite", "Banking", 
                          "Currency", "Sovereign", 
                          "Sudden Stop"), width = "120px")) 
) 
    ,column(width = 1) #empty column for space in between 
    ,column(width = 9, 
    div(style="display:inline-block",radioButtons("top_ten_normalisation_type_radio","Normalisation", 

    ... 
) 

Unterhalb einer vollständig reproduzierbar Beispiel:

library(shiny) 
library(shinydashboard) 
body <- dashboardBody(
    box(
     title = "Title" 
     ,status = "primary" 
     ,column(width = 1, 
     div(style="display:inline-block",selectInput('crisis_type_top_10_imp_wors', 'Crisis', c("Composite", "Banking", 
                           "Currency", "Sovereign", 
                           "Sudden Stop"), width = "120px")) 
    ) 
     ,column(width = 1) 
     ,column(width = 10, 
     div(style="display:inline-block",radioButtons("top_ten_normalisation_type_radio","Normalisation", 
                 c("Global" = "Global", 
                 "Regional" = "Regional", 
                 "Own Country" = "Own Country") 
                 ,inline=T)) 
    ) 

     ,solidHeader = FALSE 
     ,collapsible = FALSE 
     ,dataTableOutput("topTen") 
     , height = 660 
     , align='ccc' 
     , width = 12 
    ) 
) 

shinyApp(
    ui = dashboardPage(
    dashboardHeader(title = "tabBoxes"), 
    dashboardSidebar(), 
    body 
), 
    server = function(input, output) { 
    # The currently selected tab from the first box 
    output$tabset1Selected <- renderText({ 
     input$tabset1 
    }) 
    } 
) 
+1

Das funktionierte, ich danke Ihnen sehr – OwlieW