Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
结合fluidRow的闪亮navbarPage_R_Shiny_Fluid - Fatal编程技术网

结合fluidRow的闪亮navbarPage

结合fluidRow的闪亮navbarPage,r,shiny,fluid,R,Shiny,Fluid,我在设置闪亮应用程序的布局时遇到了一些问题。在尝试了几个不同的选项后,对我来说最合适的是navbarPage。虽然我设法解决了我的大部分问题(借助stackoverflow),但我还是陷入了其中。 基本上,我有一个包含许多列的表,它最终总是比包含该表的wellPanel大 下面是一些说明问题的代码: require(shiny) require(shinythemes) side_width <- 5 sidebar_panel <- sidebarPanel( wi

我在设置闪亮应用程序的布局时遇到了一些问题。在尝试了几个不同的选项后,对我来说最合适的是navbarPage。虽然我设法解决了我的大部分问题(借助stackoverflow),但我还是陷入了其中。 基本上,我有一个包含许多列的表,它最终总是比包含该表的wellPanel大

下面是一些说明问题的代码:

require(shiny)
require(shinythemes)

side_width <- 5

sidebar_panel <-
  sidebarPanel(
    width = side_width,
    radioButtons("Radio1",
                 label = h4("Radio label 1"),
                 choices = list("Europe" = "EU", 
                                "USA" = "US"), 
                               selected = "EU"),
hr()
br()

    radioButtons("Radio 2", 
                 label = h4("Radio label 2"),
                 choices = list("Annual" = 1, "Monthly" = 12), 
                             selected = 1)

  )

main_panel <- mainPanel(
    width = 12 - side_width,


                     wellPanel(

                     h5(helpText("Figure 1: ..."))
                               ), 

                     wellPanel(
                       h5(helpText("Table 1: ..."))
                              ),

                     wellPanel(
                       h5(helpText("Table 2: ..."))
                               ),

                     wellPanel(
                              fluidRow(
                              column(12,

                                h5(helpText("Table 3: ..."))
                                    )
                                 )

                       )
)

# user interface
ui <- shiny::navbarPage("testing shiny", 

  tabPanel("Tab1",
    sidebarLayout(
    sidebarPanel = sidebar_panel,
    mainPanel = main_panel,
    position = "left")
           ),

  tabPanel("Tab2",
    verbatimTextOutput("summary")
            ),

  tags$style(type="text/css", "body {padding-top: 70px;}"),
  theme=shinytheme("cosmo"),
  position ="fixed-top"

)

server <- function(input, output) {

}

shinyApp(ui = ui, server = server)

require(闪亮)
需要(发光体)

side_widthfluidRow和column函数在wellPanel/mainPanel内不起任何作用-您希望将此特定wellPanel作为其自己的fluidRow与侧栏布局分开

此外,如果您的表格是在DT软件包中制作的,则可以将scrollX=TRUE添加到渲染选项中,以便在表格太大而无法容纳时添加滚动条

require(shiny)
require(shinythemes)

side_width <- 5

# user interface
ui <- navbarPage(
  "testing shiny",
  tabPanel("Tab1",
    sidebarLayout(position = "left",
      sidebarPanel(width = side_width,
        radioButtons("Radio1",
          label = h4("Radio label 1"),
          choices = list("Europe" = "EU",
                         "USA" = "US"),
          selected = "EU"),
        hr(),
        br(),
        radioButtons("Radio 2",
          label = h4("Radio label 2"),
          choices = list("Annual" = 1, "Monthly" = 12),
          selected = 1)),
      mainPanel(
        width = 12 - side_width,
        wellPanel(
          h5(helpText("Figure 1: ..."))
        ),        
        wellPanel(
          h5(helpText("Table 1: ..."))
        ),
        wellPanel(
          h5(helpText("Table 2: ..."))
        )
      )
    ),
    fluidRow(
        column(12,
            wellPanel(
               h5(helpText("Table 3: ..."))
            )
        )
    )
  ),

  tabPanel("Tab2",
           verbatimTextOutput("summary")),

  tags$style(type = "text/css", "body {padding-top: 70px;}"),
  theme = shinytheme("cosmo"),
  position = "fixed-top"

)
require(闪亮)
需要(发光体)

非常感谢你把这个整理出来。它快把我逼疯了。我想我现在更好地理解了fluidrow和column函数。另外,我组织代码的方式可能也没有帮助。我已经用古典的方式安排好了。干杯不客气!是的,我发现特定的代码组织是不必要的-使用传统的方式更容易调试:)为了将来的参考,您可以跳过整个“侧边栏布局”部分,只是为了更大的灵活性(例如,可能做一个三列布局!)