【发布时间】:2018-11-28 14:48:46
【问题描述】:
您能否与我分享一个闪亮的应用程序示例,其中使用下载按钮将 textAreaInput 的内容导出为 .txt 文件。 谢谢。
【问题讨论】:
您能否与我分享一个闪亮的应用程序示例,其中使用下载按钮将 textAreaInput 的内容导出为 .txt 文件。 谢谢。
【问题讨论】:
你可以这样做:
library(shiny)
ui <- fluidPage(
textAreaInput("text", "Enter text:"),
downloadButton("download", "Download")
)
server <- function(input, output) {
output$download <- downloadHandler(
filename = function() {
"textarea.txt"
},
content = function(file) {
cat(input$text, file=file)
}
)
}
shinyApp(ui, server)
【讨论】: