私は、光沢のあるタブボックス内の2つの別々のタブパネルに同じヒストグラムをプロットしようとしています。私はタブの1つにデータをプロットすることができますが、私は別のコードを追加すると、アプリケーションを壊すようです。以下は、私がやろうとしているの例です。この特定の例では光沢のある2つのtabPanelで同じ出力をプロットする
library(shiny)
library(dplyr)
data(mtcars)
body <- dashboardBody(
fluidRow(
tabBox(
title = "miles per gallon",
id = "tabset1", height = "250px",
tabPanel("Tab1", plotOutput("plot1")),
tabPanel("Tab2", plotOutput("plot1"), "test") # the app 'breaks' when I add in the **plotOutput("plot1")** here... however it works when I remove it
)
)
)
shinyApp(
ui = dashboardPage(
dashboardHeader(title = "Test"),
dashboardSidebar(),
body
),
server = function(input, output) {
output$plot1 <- renderPlot({hist(mtcars$mpg)})
}
)
、私はちょうどこの
output$plot2 <- renderPlot({hist(mtcars$mpg)})
のように、サーバー内の別の行を追加してからplot2を呼び出して、私の実際の可能性appは上記の例より少し複雑ですので、両方のタブにplot1をプロットしたいと思います。