我想将我的整个代码放在操作按钮中。当我单击按钮时,我的整个代码仪表板应该在我的屏幕中可见(我现在正在我的代码中看到)但首先我必须只能看到那个按钮。
这是我试图放入按钮的示例仪表板。我没有在这段代码中制作按钮,因为这很简单。有人可以帮忙吗?
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "Basic dashboard"),
dashboardSidebar(),
dashboardBody(
# Boxes need to be put in a row (or column)
fluidRow(
box(plotOutput("plot1", height = 250)),
box(
title = "Controls",
sliderInput("slider", "Number of observations:", 1, 100, 50)
)
)
)
)
server <- function(input, output) {
set.seed(122)
histdata <- rnorm(500)
output$plot1 <- renderPlot({
data <- histdata[seq_len(input$slider)]
hist(data)
})
}
shinyApp(ui, server)