use*_*875 5 r shiny shinydashboard
我想创建一个带有导航栏的闪亮应用程序,但也能够使用流体行()和流体列()在页面上配置布局。
我在这里阅读了“导航栏页面”和“流体网格系统”区域http://shiny.rstudio.com/articles/layout-guide.html 并在流体网格系统下它说“要创建基于流体系统的布局你使用fluidPage()函数。” 所以这是我的例子:
服务器文件
shinyUI(navbarPage("",
tabPanel("test",
#THIS IS THE SIDEBAR INPUT PANEL
column(2,wellPanel(
selectInput("x", "x:", c(5, 10,30,60),selected = 5)
)),
#THIS IS THE MAIN CONTENT
column(10,
fluidRow( plotOutput("plot3")) #,
#fluidRow(
# column(width=5, plotOutput("plot2")),
# column(width=5, plotOutput("plot3"))
# )
)#end of main body columns
)#end tab panel
,
tabPanel("summary",
verbatimTextOutput("summary")
),
navbarMenu("More Info",
tabPanel("Test1",
dataTableOutput("table")
)
)
))
ui.r
library(shinydashboard)
library(reshape)
library(quantmod)
library(ggplot2)
library(reshape2)
library(scales)
shinyServer(function(input, output, session) {
output$plot1 <- renderPlot({
#plot(cars, type=input$plotType)
plot(c(1))
})
output$plot2 <- renderPlot({
#plot(cars, type=input$plotType)
plot(c(100))
})
output$plot3 <- renderPlot({
#plot(cars, type=input$plotType)
plot(c(-2001))
})
output$summary <- renderPrint({
summary(cars)
})
output$table <- renderDataTable({
cars
}, options=list(pageLength=10))
})#### END OF SHINY SERVER FUNCTION
Run Code Online (Sandbox Code Playgroud)
所以上面的代码有效并且它有一个导航栏。但是我想在“测试”选项卡面板的 ui.r 页面上添加另一个流体行。你可以看到我注释掉了这些行:
#fluidRow(
# column(width=5, plotOutput("plot2")),
# column(width=5, plotOutput("plot3"))
# )
Run Code Online (Sandbox Code Playgroud)
我想取消注释它们并显示一个带有 2 列的流体行。但是当我取消注释这些行时,应用程序不会返回任何内容。
那么是否有可能有一个导航栏页面并像这样进行流畅的布局?
或者我需要使用fluidPage()而不是navBarPage()吗?但是那你怎么用fluidPage做一个导航栏??