在navbarPage中以闪亮的方式显示不同数量的选项卡面板,而不显示renderUI或uiOutput

在navbarPage中以闪亮的方式显示不同数量的选项卡面板,而不显示renderUI或uiOutput,r,shiny,R,Shiny,我试图在一个navbarPage中以闪亮的方式显示1到5个tabPanels 我的代码生成了5个绘图,但我希望用户能够选择他们想要访问的绘图数量——在每个选项卡面板中显示一个绘图 我有一个外部配置文件(config.txt),通过source('config.txt'),我可以访问一个页数变量 例如,number\u of_tabPages如果您不需要用户以交互方式更改tabPanel的数量,只需在应用程序启动时加载不同数量的选项卡,则可以使用navBarPage中的do.call功能: lib

我试图在一个
navbarPage
中以闪亮的方式显示1到5个
tabPanels

我的代码生成了5个绘图,但我希望用户能够选择他们想要访问的绘图数量——在每个
选项卡面板中显示一个绘图

我有一个外部配置文件(
config.txt
),通过
source('config.txt')
,我可以访问一个
页数
变量


例如,
number\u of_tabPages如果您不需要用户以交互方式更改
tabPanel
的数量,只需在应用程序启动时加载不同数量的选项卡,则可以使用
navBarPage
中的
do.call
功能:

library(dplyr)
library(shiny)
library(ggvis)

#number of tabs needed
number_of_tabPages <- 10

#make a list of all the arguments you want to pass to the navbarPage function
tabs<-list()
#first element will be the title, empty in your example
tabs[[1]]=""

#add all the tabPanels to the list
for (i in 2:(number_of_tabPages+1)){
  tabs[[i]]=tabPanel(paste0("Tab",i-1),plotOutput(paste0("plot",i-1)))

}

 #do.call will call the navbarPage function with the arguments in the tabs list
shinyUI(fluidRow(
  column(12,
         "", 
         do.call(navbarPage,tabs)
         )
  )
)
库(dplyr)
图书馆(闪亮)
图书馆(ggvis)
#所需的选项卡数
选项卡页数
library(dplyr)
library(shiny)
library(ggvis)

#number of tabs needed
number_of_tabPages <- 10

#make a list of all the arguments you want to pass to the navbarPage function
tabs<-list()
#first element will be the title, empty in your example
tabs[[1]]=""

#add all the tabPanels to the list
for (i in 2:(number_of_tabPages+1)){
  tabs[[i]]=tabPanel(paste0("Tab",i-1),plotOutput(paste0("plot",i-1)))

}

 #do.call will call the navbarPage function with the arguments in the tabs list
shinyUI(fluidRow(
  column(12,
         "", 
         do.call(navbarPage,tabs)
         )
  )
)