Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
shinydashboard:按下按钮x秒后执行数据导入_R_Shiny_Shinydashboard - Fatal编程技术网

shinydashboard:按下按钮x秒后执行数据导入

shinydashboard:按下按钮x秒后执行数据导入,r,shiny,shinydashboard,R,Shiny,Shinydashboard,背景 我正在构建一个闪亮的仪表板,用户必须从selectizeInput中选择要处理的文件,然后按SubmitactionButton。按下按钮后,它将启动一个后端进程,以确定文件属于哪一类别以及应遵循哪一工作流(不同的工作流包含不同的清理步骤和最终输出)。工作流完成后,我希望在DT::renderDataTable中显示最终输出 所需输出 我希望我的闪亮应用程序 选择输入前不显示任何数据 比如说,从某人单击提交按钮到实际拾取数据集的时间为30秒 最小工作示例 我如何在这个简单的应用程序中实

背景

我正在构建一个闪亮的仪表板,用户必须从
selectizeInput
中选择要处理的文件,然后按Submit
actionButton
。按下按钮后,它将启动一个后端进程,以确定文件属于哪一类别以及应遵循哪一工作流(不同的工作流包含不同的清理步骤和最终输出)。工作流完成后,我希望在
DT::renderDataTable
中显示最终输出

所需输出

我希望我的闪亮应用程序

  • 选择输入前不显示任何数据
  • 比如说,从某人单击提交按钮到实际拾取数据集的时间为30秒
最小工作示例

我如何在这个简单的应用程序中实现它

用户界面

库(闪亮)
图书馆(shinydashboard)
图书馆(DT)
图书馆(dataiku)

我建议不要使用计时器。相反,请确保您的应用程序在进程完成运行时更新。例如,让进程用结果编写一个RDS文件,并使用a使您的应用程序依赖于对该文件的更改。那么包中的
delay()
呢?
library(shiny)
library(shinydashboard)
library(DT)
library(dataiku)

path <- dkuManagedFolderPath("receiver") #folder with the files to choose from


dashboardPage(
  dashboardHeader(title = "Catchy Title"),
  dashboardSidebar(


   selectizeInput("file", "Select File",
                list.files(path)), 

  actionButton("submit", "Submit")
  ),
  dashboardBody(
    fluidRow(

    box(h2("Show Data"),
        div(style = 'overflow-x: scroll', DT::dataTableOutput('mytable')),
          width = 12)
    )
  )
  )
library(dataiku)
library(shiny)
library(shinydashboard)
library(DT)
library(dplyr)



shinyServer(function(input, output) {

file_name <- reactive({ 
req(input$file)
})

####
# run the process that takes the file name to pass it to 
# the global environment, which triggers the conditional workflow  
# and may result in different data outputs
####

## AFTER the process runs (approx. 30 seconds after pressing the submit button)
# I want the shiny app to follow this logic:

if(is.null(nrow(try(dkuReadDataset("intermediate_dataset"))[1]))){
    df <- dkuReadDataset("final_data1")
    } else{
    df <- dkuReadDataset("final_data2")
    }


output$mytable = DT::renderDataTable({
       df
    })  

})