2017-07-22 1 views
0

(余分な行を追加しなくても)fileInputとcheckboxInputの間に余分なスペースがあるようです。その余分な行をどうやって取り除くのですか?ありがとう!Rのファイルインプットとチェックボックスインプットの余分な行Shiny

if (interactive()) { 

ui <- fluidPage(
    sidebarLayout(
    sidebarPanel(
     fileInput("file1", "Choose CSV File", 
     accept = c(
      "text/csv", 
      "text/comma-separated-values,text/plain", 
      ".csv") 
     ), 
     checkboxInput("header", "Header", TRUE) 
    ), 
    mainPanel(
     tableOutput("contents") 
    ) 
) 
) 

server <- function(input, output) { 
    output$contents <- renderTable({ 
    inFile <- input$file1  
    if (is.null(inFile)) 
     return(NULL)  
    read.csv(inFile$datapath, header = input$header) 
    }) 
} 

shinyApp(ui, server) 
} 

答えて

0

これは、進行状況バーのスペースです。

 tags$style(".shiny-input-container {margin-bottom: 0px} #file1_progress { margin-bottom: 0px } .checkbox { margin-top: 0px}"), 
:あなたは余分なパッケージなしでネイティブCSSをしたい場合は、

inlineCSS(list(".shiny-input-container" = "margin-bottom: 0px", 
       "#file1_progress" = "margin-bottom: 0px", 
       ".checkbox" = "margin-top: 0px")) 

か:あなたは、パッケージshinyjsをロードし、あなたのUIでこれのどこを挿入することにより、CSSと周囲の要素の余白を削除することができます

Tipp:削除する領域を右クリックし、「要素の検査」を選択します。次に、スペースがHTMLのどのノードにあるかを確認します。

enter image description here

関連する問題