【发布时间】:2021-05-07 12:48:14
【问题描述】:
我有如下代码,我想在刷过的点上添加一个Save 按钮。非常感谢。
library(shiny)
ui <- basicPage(
plotOutput("plot1", brush = "plot_brush"),
verbatimTextOutput("info")
)
server <- function(input, output) {
x <- NULL
output$plot1 <- renderPlot({
plot(mtcars$wt, mtcars$mpg)
})
output$info <- renderPrint({
x <<- brushedPoints(mtcars, input$plot_brush, xvar = "wt", yvar = "mpg")
x
})
}
shinyApp(ui, server)
【问题讨论】:
-
点击保存按钮后,您是希望在您的环境中将刷过的行保存为数据框还是将它们写为 csv?
-
你好,将它们导出为 csv 会很好。