R闪亮文件输入大文件 [英] R shiny fileInput large files

查看:110
本文介绍了R闪亮文件输入大文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对于R Shiny的fileInput有问题.默认情况下,大小限制设置为5MB. 由于我必须使用的文件非常大(> 50GB),因此我只需要数据路径和文件名.不幸的是,fileInput要上传完整的文件,或者至少它以某种方式正在加载文件,并告诉我在我达到5MB限制后文件太大.

i have some problem with fileInput for R Shiny. Size limit is set to 5MB per default. Since the files i have to work with are very large (>50GB), I only need the datapath and or name of the file. Unfortunatly fileInput wants to upload the complete file or at least it is loading the file somehow and tells me that the file is too big after i have reached the 5MB limit.

如何仅将应用程序的路径移交而不上传文件?

How can I only hand over the path to my app without uploading the file?

ui.R

library(shiny)

# Define UI ----
shinyUI(fluidPage(
h1("SAS Toolbox"),

tabsetPanel(
  tabPanel("SASFat",
     sidebarPanel(h2("Input:"),
        actionButton("runSASFat","Run Job",width="100%",icon("paper-plane"), 
        style="color: #fff; background-color: #337ab7; border-color: #2e6da4"),       

        wellPanel(
           #tags$style(".shiny-file-input-progress {display: none}"),
           fileInput("FEInp","Pfad FE input Deck:"), 
           fileInput("FERes","Pfad FE Results:") 
        ),
        wellPanel(
           checkboxGroupInput("options1","Auswertung:",c("Grundmaterial","Schweissnähte")),
           conditionalPanel(condition="$.inArray('Schweissnähte',input.options1) > -1", 
           sliderInput("filter", "Filter:", 0.75, min = 0, max = 1))
        ),
        wellPanel(
           radioButtons("solver", "Solver:", c("Ansys","Abaqus", "Optistruct")),
           conditionalPanel(condition="input.solver == 'Ansys'",selectInput("lic", "Lizenz",c("preppost","stba","meba"))) 
        ),
        wellPanel(
           checkboxGroupInput("options2","Optionen:",c("Schreibe LCFiles"))
        )
     ),
     mainPanel(br(),h2("Output:"),width="30%")
  ), 
  tabPanel("Nietauswertung"),
  tabPanel("Spannungskonzept EN12663")
  )
))

server.R

# Define server logic ----
shinyServer(function(input, output) {
  observeEvent(input$runSASFat, {
    FEInp <- input$FEInp
    FERes <- input$FERes
    opt1 <- input$options1 
    opt2 <- input$options2
    filter <- input$filter
    solver <- input$solver
    lic <- input$lic

    write(c(FEInp$datapath,FERes$datapath,opt1,opt2,filter,solver,lic),"ghhh.inp")
    })
})

预先感谢

迈克尔

推荐答案

以下是在闪亮的应用程序中使用file.choose()来获取文件(以及文件名)的本地路径的示例:

Here is an example of using file.choose() in a shiny app to obtain the local path of the file (and hence the file name):

library(shiny)


ui <- fluidPage(

   # Application title
   titlePanel("Choosing a file example"),


   sidebarLayout(
      sidebarPanel(
        actionButton("filechoose",label = "Pick a file")
      ),

      mainPanel(
         textOutput("filechosen")
      )
   )
)


server <- function(input, output) {

  path <- reactiveValues(
    pth=NULL
  )


  observeEvent(input$filechoose,{
    path$pth <- file.choose()
  })

   output$filechosen <- renderText({

      if(is.null(path$pth)){
        "Nothing selected"
      }else{
        path$pth
      }
   })
}

# Run the application 
shinyApp(ui = ui, server = server)

这是你的追求吗?

这篇关于R闪亮文件输入大文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆