R闪亮书签桶列表
我试图通过书签方法实现R输入的持久数据存储。但是,我无法保留与桶列表相关的数据 例如,如果我从以下代码开始,并将n个项目转移到第二个存储桶列表,则不会存储输入。我怎样才能纠正这一点?多谢各位R闪亮书签桶列表,r,shiny,R,Shiny,我试图通过书签方法实现R输入的持久数据存储。但是,我无法保留与桶列表相关的数据 例如,如果我从以下代码开始,并将n个项目转移到第二个存储桶列表,则不会存储输入。我怎样才能纠正这一点?多谢各位 library(shiny) ui <- fluidPage( bucket_list( header = "This is a bucket list. You can drag items between the lists.", add_rank_list(
library(shiny)
ui <- fluidPage( bucket_list(
header = "This is a bucket list. You can drag items between the lists.",
add_rank_list(
text = "Drag from here",
labels = c("a", "bb", "ccc")
),
add_rank_list(
text = "to here",
labels = NULL
)
),
bookmarkButton())
server <- function(input, output, session) {
}
enableBookmarking(store = "url")
shinyApp(ui, server)
库(闪亮)
ui上面的最小示例缺少一些位。下面是一个最小的示例,显示了用于持久存储选择的书签
library(shiny)
ui <- function(request) {
fluidPage(
textInput("txt", "Text"),
checkboxInput("chk", "Checkbox"),
bookmarkButton()
)
}
server <- function(input, output, session) {
}
enableBookmarking("url")
shinyApp(ui, server)
谢谢,阿什。我还有其他部分(如checkboxInput)将OK标记为书签。
library(shiny)
library(sortable)
ui <- function(request) {
fluidPage(
uiOutput("bucket"),
bookmarkButton()
)
}
server <- function(input, output, session) {
output$bucket <- renderUI({
bucket_list(
header = "This is a bucket list. You can drag items between the lists.",
add_rank_list(
text = "Drag from here",
labels = c("a", "bb", "ccc"),
input_id = 'list1'
),
add_rank_list(
text = "to here",
labels = NULL,
input_id = 'list2'
)
)
})
#When creating a bookmark, manually store the selections from our bucket lists
onBookmark(function(state) {
state$values$list1 <- input$list1
state$values$list2 <- input$list2
})
#When restoring a bookmark, manually retrieve the selections from our bucket lists and re-render the bucket list input
onRestore(function(state) {
output$bucket <- renderUI({
bucket_list(
header = "This is a bucket list. You can drag items between the lists.",
add_rank_list(
text = "Drag from here",
labels = state$values$list1,
input_id = 'list1'
),
add_rank_list(
text = "to here",
labels = state$values$list2,
input_id = 'list2'
)
)
})
})
}
enableBookmarking("url")
shinyApp(ui, server)