Shiny : sidebarPanel sidebarLayout 之间的区别

标签 shiny sidebar

我一直在想,什么时候使用 sidebarLayout,什么时候不使用。我被卡住了,也许这里有人可以向我解释一下。

谢谢。

最佳答案

基本上与sidebarLayout您指定页面的布局,这意味着您的页面将一分为二; sidebarPanel和一个 mainPanel .

sidebarLayout您使用 sidebarPanel指定页面侧面板的外观。简而言之,首先您使用 sidebarLayout之后 sidebarPanel .

下面的例子取自 shiny's文档。它说明了上述内容。如果您希望您的页面看起来像下面的应用程序,您可以使用它。

library(shiny)
# Define UI
ui <- fluidPage(

  # Application title
  titlePanel("Hello Shiny!"),

  sidebarLayout(

    # Sidebar with a slider input
    sidebarPanel(
      sliderInput("obs",
                  "Number of observations:",
                  min = 0,
                  max = 1000,
                  value = 500)
    ),

    # Show a plot of the generated distribution
    mainPanel(
      plotOutput("distPlot")
    )
  )
)

# Server logic
server <- function(input, output) {
  output$distPlot <- renderPlot({
    hist(rnorm(input$obs))
  })
}

# Complete app with UI and server components
shinyApp(ui, server)

关于 Shiny : sidebarPanel sidebarLayout 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44161978/

相关文章:

R - Ubuntu 上的 Shiny 服务器

react-native - 使用 react-native 抽屉实现侧边栏/汉堡菜单

html - Bootstrap float 侧边栏

r - Shiny 的应用程序 : How to dynamically change box title in server. R?

r - 当输入更改(例如,选项卡更改)时,我如何告诉我的 modalDialog 自动关闭?

R Shiny - 缓存大数据帧

ios - 我在 swift 中面临一个问题 tabBar 菜单和侧边栏菜单

jquery - 侧边栏滚动问题

javascript - 如何在悬停时显示隐藏的侧边栏

r - 使用shinyFiles上传文件