在闪亮的应用程序中选择文件夹或文件夹目录

编程入门 行业动态 更新时间:2024-10-27 11:18:12
本文介绍了在闪亮的应用程序中选择文件夹或文件夹目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在使用光泽时遇到问题.我想选择要保存我要在我的应用程序中使用的所有文件的文件夹: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()) }

更多推荐

在闪亮的应用程序中选择文件夹或文件夹目录

本文发布于:2023-11-12 17:04:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1582044.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件夹   应用程序   目录

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!