R 是否将数据帧保存在Shiny中,以便以后访问并下载?

R 是否将数据帧保存在Shiny中,以便以后访问并下载?,r,shiny,R,Shiny,我是新手。 我有一个非常基本的问题,但我在这里找不到有关stackoverflow的解决方案。 我正在使用wleepang()创建的目录输入函数。 我编写了一个函数read_files,用于rbind选定目录中的所有文件。 我可以用可渲染的显示此表,这非常有效。但我无法保存此表以供以后使用(检查缺少的数据、添加列、绘制ggplots…)和下载is withwrite.xlsx ui <- fluidPage( directoryInput('directory', label = 'sel

我是新手。 我有一个非常基本的问题,但我在这里找不到有关stackoverflow的解决方案。
我正在使用wleepang()创建的目录输入函数。 我编写了一个函数
read_files
,用于rbind选定目录中的所有文件。 我可以用可渲染的显示此表,这非常有效。但我无法保存此表以供以后使用(检查缺少的数据、添加列、绘制ggplots…)和下载is withwrite.xlsx

ui <- fluidPage(
directoryInput('directory', label = 'select a directory'),
actionButton("upload", label="Hochladen"),
downloadButton("download", label="Runterladen")
)  

server <- function(input, output, session) {
#this part is to set the directory
 observeEvent(
 ignoreNULL = TRUE,
 eventExpr = {
   input$directory
 },
 handlerExpr = {
   if (input$directory > 0) {
  path = choose.dir(default = readDirectoryInput(session, 'directory'))
  updateDirectoryInput(session, 'directory', value = path)
  }})
#now comes the actual code

  observeEvent(input$upload,{
 df <- read_files(readDirectoryInput(session, 'directory'))
})

我已使用反应函数保存元素

upload_data <- eventReactive(input$upload, {      
read_files(readDirectoryInput(session, 'directory')) }) 

上传_数据1。您可以使用as
R object
保存数据,然后使用,2读取数据。下载为xlxs查看@parth我已使用反应式函数保存元素
upload_data@parth save在shiny中不起作用,或者你能给我一个代码示例吗?谢谢
source('directoryInput.R')
read_files = function(inDir, pat="*.csv", readMe=read.csv2){
files = list.files(inDir, pattern=pat)
files = lapply(files, function(x) file.path(inDir, x))
df = do.call(rbind, lapply(files, readMe))
return(df)
}
upload_data <- eventReactive(input$upload, {      
read_files(readDirectoryInput(session, 'directory')) })