I am able to use Bookmark at Shiny ,But does not work at Shiny Dashboard .
bookmarkButton() give me a new url. But i enter it ,it dose not get me the new result.
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),
bookmarkButton()
)
)
)
)
server <- function(input, output,session) {
set.seed(122)
histdata <- rnorm(500)
output$plot1 <- renderPlot({
data <- histdata[seq_len(input$slider)]
hist(data)
})
}
enableBookmarking(store = "url")
shinyApp(ui, server)
Your UI should be a function, as is indicated by the error you get, see also the documentation
Working example:
library(shinydashboard)
ui <- function(request) {
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),
bookmarkButton()
)
)
)
)
}
server <- function(input, output,session) {
set.seed(122)
histdata <- rnorm(500)
output$plot1 <- renderPlot({
data <- histdata[seq_len(input$slider)]
hist(data)
})
}
enableBookmarking(store = "url")
shinyApp(ui, server)
Hope this helps!