R Shiny 应用程序移动图位置

问题描述

我目前正在 R-Shiny 中构建一个应用程序,但由于我向应用程序添加了选项卡,因此在图形位置方面遇到了问题。我想将图形从输入下方的第一个选项卡移动到它们的右侧。我目前收到来自 R 的以下消息。

bootstrapPage(position =) 从闪亮的 0.10.2.2 开始被弃用。 'position' 参数不再用于最新版本的 Bootstrap。 tabsetPanel(position = "right",tabPanel("Drawdown Plot",plotOutput("line"),: 缺少参数,没有认值

任何帮助将不胜感激!代码如下

ui <- fluidPage(
  titlePanel("Drawdown Calculator"),theme = bs_theme(version = 4,bootswatch = "minty"),sidebarPanel(
    numericInput(inputId = "pot",label = "Pension Pot",value = 500000,min = 0,max = 2000000,step = 10000),numericInput(inputId = "with",label = "Withdrawal Amount",value = 40000,max = 200000,step = 1000),numericInput(inputId = "age",label = "Age",value = 65,max = 90,min = 40),sliderInput(inputId = "int",label = "Interest",value = 4,max = 15,step = 0.1)),mainPanel(
    tabsetPanel(position = "right",p("This drawdown calculator calculates a potential drawdown outcome")),tabPanel ("Breakdown of Drawdown Withdrawals",tableOutput("View")),))
)

解决方法

试试这个代码 -

library(shiny)
library(bslib)

ui <- fluidPage(
  titlePanel("Drawdown Calculator"),theme = bs_theme(version = 4,bootswatch = "minty"),sidebarPanel(
    numericInput(inputId = "pot",label = "Pension Pot",value = 500000,min = 0,max = 2000000,step = 10000),numericInput(inputId = "with",label = "Withdrawal Amount",value = 40000,max = 200000,step = 1000),numericInput(inputId = "age",label = "Age",value = 65,max = 90,min = 40),sliderInput(inputId = "int",label = "Interest",value = 4,max = 15,step = 0.1)),mainPanel(
    tabsetPanel(
      tabPanel("Drawdown Plot",p("This drawdown calculator calculates a potential drawdown outcome"),tableOutput("View")),tabPanel("Breakdown of Drawdown Withdrawals",plotOutput("line"))
))
)

server <- function(input,output) {}

shinyApp(ui,server)