我在使用光泽时遇到问题.我想选择要保存我要在我的应用程序中使用的所有文件的文件夹:1)通过将工作目录设置为该文件夹路径,或2)通过将该文件夹内的所有csv数据上传到我的应用程序进行进一步处理. 1)我发现了ShinyFiles软件包,但是它非常非常慢-不是由于我的PC-,而且还给了我错误:
I have a problem using shiny. I want to choose the folder where all the files I want to use in my app are saved either 1) by setting the working directory to that folderpath or 2) by uploading all csv data inside this folder to my app for further processing. for 1) I found the shinyFiles package but it is very very slow -not due to my PC- as well as giving me the error:
Warning: Error in dir.create: invalid 'path' argument Stack trace (innermost first): 59: dir.create 58: dirCreate 57: observerFunc 2: runApp 1: shinyFilesExample当我选择一个文件夹并且创建文件夹"按钮变得可单击时,我将新文件夹的名称放入其中,然后单击该面板下方的"+".有人知道为什么吗?尽管此方法有效,但速度非常慢.下面的代码:
when I selected a folder and the create folder button becomes clickable and I am putting a name of the new folder into it and clicking on the "+" beneath that panel. Anybody knows why? Despite that this method works but is very very slow. code below:
library(shiny) library(shinyFiles) ui<-fluidPage(sidebarLayout( sidebarPanel( shinyDirButton("dir", "Chose directory", "Upload") ), mainPanel( h4("output$dir"), verbatimTextOutput("dir"), br() ) )) server <- function(input,output,session){ # dir shinyDirChoose(input, 'dir', roots = getVolumes()) dir <- reactive(input$dir) output$dir <- renderPrint(dir()) } shinyApp(ui = ui, server = server)还有其他选择吗?也许通过fileInput函数上传所有csv数据?还是另一种方式?它不应该只在本地运行,而应该在服务器上运行,因此choose.dir可能不是正确的方法. 非常感谢
Is there another option? Maybe to upload all csv data via the fileInput function? Or another way? It should not work only locally but on a server so choose.dir might be not the right way. Many thanks
推荐答案函数 getwd()获取当前的工作目录.
The funktion getwd() gets your current working directory.
server <- function(input,output,session){ # dir shinyDirChoose(input, 'dir', roots = c(name=getwd())) dir <- reactive(input$dir) output$dir <- renderPrint(dir()) }更多推荐
在闪亮的应用程序中选择文件夹或文件夹目录
发布评论