繁体   English   中英

部署 R shiny 应用程序后出错(找不到对象)

[英]Error after deploying R shiny app (object not found)

我正在开发我的第一个shiny应用程序,在将应用程序发布到 shinyapp.io 服务器时遇到了问题。 该应用程序在我的 R Studio 本地运行良好,但是在部署后并在 web 浏览器中打开时,它在日志中显示一条错误消息: “Warning: Error in unique: object 'df_app_MT' not found”. 但是 'df_app_MT' 已经存在于 .Rdata 中。 我已经浏览了几个帖子,但错误仍然存在。

我已将(ui.R、server.R 和.Rdata)放在应用程序的文件夹中。 还检查了闪亮仪表板,应用程序(状态显示“正在运行”)。 这是我当前的 ui.R 代码和日志详细信息以及屏幕截图。 请帮助我如何解决此问题。

谢谢你,图菲克

ui.R

library(shinydashboard)
library(shiny) 
library(dplyr) 
library(ComplexHeatmap) 
library(ggplot2)
library(BiocManager)
options(repos = BiocManager::repositories())


load("datafile.RData")

# Define UI
ui <- dashboardPage(skin = "red",
                    dashboardHeader(title = "Testing") ,
                    dashboardSidebar(
                      sidebarMenu(
                        menuItem("MENU")
                      ),
                      sidebarMenuOutput("menu")
                      
                      
                    ),
                    dashboardBody(
                      tabItems(
                        tabItem("gridfingerprint",
                                fluidRow(
                                  
                                  box(width = NULL,solidHeader = TRUE,
                                      plotOutput("plot2", height = 500)
                                      
                                  ),
                                  fluidRow(
                                    
                                    box(width = NULL,solidHeader = TRUE,
                                        plotOutput("plot_map", height = 500))
                                  ),
                                  fluidRow(
                                    column(width = 4,
                                           box(width = NULL,status = "warning",
                                               downloadButton("gridplot",label = "Download image")
                                           )
                                    ),
                                    column(width = 3, offset = 1,
                                           box(width = NULL, status = "warning",
                                               downloadButton("downloadlist",label = "Download table")    
                                           ))
                                    
                                  )
                                )
                        ),
                        tabItem(tabName = "individualfingerprint", 
                                h5("Fingerprint heatmap displaying patterns of annotated modules across individual study subjects"),
                                fluidRow(
                                  box(width = 12,solidHeader = TRUE, (div(style='width:1400px;overflow: auto;height:800px;',
                                                                          plotOutput("plot4",height = 1200, width = 2550)))
                                  ),
                                  fluidRow(
                                    column(width = 4,
                                           box(width = NULL,status = "warning",
                                               downloadButton("downloadindplot",label = "Download image")
                                           )
                                    ),
                                    column(width = 3, offset = 1,
                                           box(width = NULL, status = "warning",
                                               downloadButton("individualtable",label = "Download table")    
                                           ))
                                    
                                  )
                                )),
                        
                        tabItem("complexplot",
                                fluidRow(
                                  column(width = 12,
                                         box(width = NULL,solidHeader = TRUE, (div(style='width:1400px;overflow: auto;',
                                                                                   plotOutput("plot3",height = 800, width = 4600)))),
                                         fluidRow(
                                           column(width = 4,
                                                  box(width = NULL,status = "warning",
                                                      downloadButton("aggregateplot",label = "Download image")
                                                  )
                                           ),
                                           column(width = 3, offset = 1,
                                                  box(width = NULL, status = "warning",
                                                      downloadButton("downloadaggregate",label = "Download table")    
                                                  ))
                                           
                                         )
                                  )
                                  
                                ))
                      )
                    )
)

server.R

server = function(input, output) {
  output$menu <- renderMenu({
    sidebarMenu(
      menuItem("FINGERPRINT GRIDS", tabName = "gridfingerprint"),
      menuItem("Choose disease", icon = icon("bar-chart-o"),
               # Input directly under menuItem
               selectInput(inputId = "diseaseInput",
                           label = "",
                           choices = unique(df_app_MT$diseases), multiple=F, selectize=TRUE,
                           width = '98%'), tabName = "gridfingerprint"),
      
      
      menuItem("MODULES X STUDIES", tabName = "complexplot"),
      menuItem("Choose aggregate", icon = icon("bar-chart-o"),
               # Input directly under menuItem
               selectInput(inputId = "aggregateInput",
                           label = "",
                           choices = unique(df_app_MT$Aggregate), multiple=F, selectize=TRUE,
                           width = '98%'),tabName = "complexplot"),
      

      menuItem("MODULES X INDIVIDUALS", tabName = "individualfingerprint"),
      menuItem("Choose disease", icon = icon("bar-chart-o"),
               # Input directly under menuItem
               selectInput(inputId = "IllnessInput",
                           label = "",
                           choices = unique(Ind_table_MT$Illness), multiple=F, selectize=TRUE,
                           width = '80%'),
               menuItem("Choose aggregate"),
               selectInput(inputId = "IndaggregateInput",
                           label = "",
                           choices = unique(df_app_MT$Aggregate),selected ="A1", multiple=T, selectize=TRUE,
                           width = '80%'),tabName = "individualfingerprint")
      


    }
  )
}

记录详细信息

2021-04-29T02:08:20.853366+00:00 shinyapps[4042863]: Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
2021-04-29T02:08:20.853367+00:00 shinyapps[4042863]: Github page: https://github.com/jokergoo/ComplexHeatmap
2021-04-29T02:08:20.853367+00:00 shinyapps[4042863]: Documentation: http://jokergoo.github.io/ComplexHeatmap-reference
2021-04-29T02:08:20.853368+00:00 shinyapps[4042863]: Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
2021-04-29T02:08:20.853369+00:00 shinyapps[4042863]:   genomic data. Bioinformatics 2016.
2021-04-29T02:08:20.853369+00:00 shinyapps[4042863]: This message can be suppressed by:
2021-04-29T02:08:20.853369+00:00 shinyapps[4042863]:   suppressPackageStartupMessages(library(ComplexHeatmap))
2021-04-29T02:08:20.853370+00:00 shinyapps[4042863]: ========================================
2021-04-29T02:08:20.853370+00:00 shinyapps[4042863]: 
2021-04-29T02:08:21.178976+00:00 shinyapps[4042863]: Bioconductor version 3.12 (BiocManager 1.30.10), ?BiocManager::install for help
2021-04-29T02:08:24.452402+00:00 shinyapps[4042863]: Warning: Error in unique: object 'df_app_MT' not found
2021-04-29T02:08:24.459069+00:00 shinyapps[4042863]:   114: unique
2021-04-29T02:08:24.459069+00:00 shinyapps[4042863]:   108: renderUI [/srv/connect/apps/test/server.R#3]
2021-04-29T02:08:24.459071+00:00 shinyapps[4042863]:    94: renderFunc
2021-04-29T02:08:24.459084+00:00 shinyapps[4042863]:     7: connect$retry
2021-04-29T02:08:24.459070+00:00 shinyapps[4042863]:   107: func
2021-04-29T02:08:24.459071+00:00 shinyapps[4042863]:    93: output$menu
2021-04-29T02:08:24.459071+00:00 shinyapps[4042863]:    13: runApp
2021-04-29T02:08:24.459083+00:00 shinyapps[4042863]:    12: fn
2021-04-29T02:08:24.459085+00:00 shinyapps[4042863]:     5: eval
2021-04-29T02:08:24.459084+00:00 shinyapps[4042863]:     6: eval
2021-04-29T02:42:03.040084+00:00 shinyapps[4042863]: Running on host: ebb9348b6b95
2021-04-29T02:42:03.046218+00:00 shinyapps[4042863]: Server version: 1.8.6.1
2021-04-29T02:42:03.046231+00:00 shinyapps[4042863]: LANG: en_US.UTF-8
2021-04-29T02:42:03.046234+00:00 shinyapps[4042863]: R version: 4.0.3
2021-04-29T02:42:03.046237+00:00 shinyapps[4042863]: shiny version: 1.6.0
2021-04-29T02:42:03.046237+00:00 shinyapps[4042863]: httpuv version: 1.5.5
2021-04-29T02:42:03.046247+00:00 shinyapps[4042863]: rmarkdown version: (none)
2021-04-29T02:42:03.046281+00:00 shinyapps[4042863]: knitr version: (none)
2021-04-29T02:42:03.046298+00:00 shinyapps[4042863]: jsonlite version: 1.7.2
2021-04-29T02:42:03.046308+00:00 shinyapps[4042863]: RJSONIO version: (none)
2021-04-29T02:42:03.046478+00:00 shinyapps[4042863]: Using pandoc: /opt/connect/ext/pandoc/2.11
2021-04-29T02:42:03.046308+00:00 shinyapps[4042863]: htmltools version: 0.5.1
2021-04-29T02:42:03.256647+00:00 shinyapps[4042863]: Starting R with process ID: '24'
2021-04-29T02:42:03.253079+00:00 shinyapps[4042863]: Using jsonlite for JSON processing

我看不出从拆分应用程序切换到单文件应用程序会如何改变任何事情,但该应用程序可能第一次无法在同一工作目录中找到 .RData 文件。 在本地,如果 df_app_MT 恰好在您的工作环境中,这可能会被忽略。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM