如何部署闪亮的应用程序? (错误打开连接)

时间:2018-11-12 14:39:35

标签: shiny

我似乎无法部署出色的应用程序。这是我得到的错误

> deployApp()
Preparing to deploy application...DONE
Uploading bundle for application: 565580...Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
  cannot open file '/var/folders/6_/gqrmklfs2vb00n2ksy7pthgh0000gn/T//RtmpnhMpxa/file63a82fe45b55': No such file or directory

我不确定为什么“ R”在那个特定位置出现。当我进入Shiny仪表板时,可以看到该应用程序已上传,但尚未部署。谢谢。

这是该代码的最低版本。它涉及读取文本文件,并将其显示为.html对象。

shinyApp(

  ui <- fluidPage(
    sidebarLayout(
      sidebarPanel(
        fileInput("text_file", "Choose text file",
                  multiple = FALSE,
                  accept = c(".txt")
        )
      ),
      mainPanel(htmlOutput("example"))
    )
  ), 

  server <- function(input, output, session){

    text <- reactive({
      req(input$text_file)
      x <- scan(input$text_file$datapath, what = "string", sep = "\n")

    })

    # text output
    output$example <- renderUI({
      HTML(text())
    })
  }



    )

1 个答案:

答案 0 :(得分:1)

我需要添加图片,因此使用答案方法:

您是否尝试过使用RStudio功能?

更新

我必须编辑您的代码才能获得该选项:

library(shiny)  

ui <- fluidPage(
    sidebarLayout(
      sidebarPanel(
        fileInput("text_file", "Choose text file",
                  multiple = FALSE,
                  accept = c(".txt")
        )
      ),
      mainPanel(htmlOutput("example"))
    )
  )

server <- function(input, output, session){

  text <- reactive({
    req(input$text_file)
    x <- scan(input$text_file$datapath, what = "string", sep = "\n")

  })

  # text output
  output$example <- renderUI({
    HTML(text())
  })
}

shinyApp(ui, server)

shinyapps publishing

相关问题