2013-06-24 4 views
11

UI에 체크 박스 옵션을 나란히 표시 할 수 있는지 궁금합니다. 내가 해봤 일부 샘플 코드 :R Shiny : Side by Side 체크 박스

shinyUI(pageWithSidebar(
    headerPanel("Example"), 
    sidebarPanel( 
    checkboxInput(inputId = "simOption", label = "Historical Data",value=TRUE), 
    checkboxInput(inputId = "simOption2", label = "Historical Data 2",value=TRUE) 


), 

    mainPanel(
tabsetPanel(

    tabPanel("Heatmap", 
      plotOutput("temp") 
), 
    tabPanel("About"), 

    id="tabs" 
)#tabsetPanel 

)#mainPane; 

)) 

답변

13

시도 fudging 일부 부트 스트랩 구문 :

?radiobutton

radioButtons("dist", "Distribution type:", 
      c("Normal" = "norm", 
       "Uniform" = "unif", 
       "Log-normal" = "lnorm", 
       "Exponential" = "exp")) 
에서 수평 라디오 버튼에 대한

shinyUI(pageWithSidebar(
    headerPanel("Example"), 
    sidebarPanel( 

    withTags(div(class='row-fluid', 
       div(class='span3', checkboxInput(inputId = "simOption", label = "Historical Data",value=TRUE)), 
       div(class='span5', checkboxInput(inputId = "simOption2", label = "Historical Data 2",value=TRUE)) 
    )) 



), 

    mainPanel(
tabsetPanel(

    tabPanel("Heatmap", 
      plotOutput("temp") 
), 
    tabPanel("About"), 

    id="tabs" 
)#tabsetPanel 

)#mainPane; 

)) 

https://medium.com/what-i-learned-building/99fdd6e46586

편집

당신은 inline = TRUE PARAM으로 checkboxGroupInput를 사용할 수있는

gsub("label class=\"radio\"", "label class=\"radio inline\"",radioButtons("dist", "Distribution type:", 
      c("Normal" = "norm", 
       "Uniform" = "unif", 
       "Log-normal" = "lnorm", 
       "Exponential" = "exp"))) 
) 
+0

나는 부트 스트랩 새로운,하지만 반짝 무엇의 경우 라디오 버튼? 위 프레임 워크를 어떻게 적용 할 수 있습니까? 라디오 버튼은 두 개의 별도 기능에 반대되는 단일 기능으로 다소 까다 롭습니다. 고마워, – user1234440

+0

https://github.com/plataformatec/simple_form/issues/649는 당신이 묘사 한 내용을 암시합니다. 기본 태그 구성 요소를 사용하여 직접 컨트롤을 만들 수 있습니다. – user1609452

+0

나 같은 게으른 게 아니라면, 너는 할 수있어. – user1609452

13

로 교체 :

checkboxGroupInput(inputId = "simOption", label = "", 
        choices = c("Historical Data" = TRUE, 
           "Historical Data 2" = TRUE), 
        inline = TRUE) 
관련 문제