【问题标题】:Unable to publish Shiny R data table无法发布 Shiny R 数据表
【发布时间】:2019-03-25 07:16:26
【问题描述】:

这是我使用 RStudio 和 Shiny 设计的第一个项目。因此,我相信有一些我还无法理解的琐碎问题。

我正在尝试使用 shinyapps.io 将两个大表作为 Shiny R App 在线发布。该代码在本地运行良好,但表格在发布时不会在线显示。见下文

https://myrmeco-fox.shinyapps.io/Transcriptome_Table/

我的脚本如下:

require(shiny)
require(DT)
ui <- fluidPage(
  title = "Summary of de novo assembly annotations",
  mainPanel(
    tabsetPanel(
      id = 'dataset',
      tabPanel("Contigs", DT::dataTableOutput("mytable1")),
      tabPanel("Isotigs", DT::dataTableOutput("mytable2"))
    )
  )
)

server <- function(input, output) {
  Contigs<-reactiveValues(Contigs_Table=read.table("Data/annotations_expanded_CONTIGS.txt", header= TRUE, sep = "\t", fill = TRUE, na.strings = c("", "---NA---"), nrows=7467, colClasses="character", quote=""))
  class(Contigs_Table$Length)<-"numeric"
  class(Contigs_Table$Cys)<-"numeric"
  Isotigs<-reactiveValues(Isotigs_Table=read.table("Data/Annotation_summary_expanded_ISOTIGS", header= TRUE, sep = "\t", fill = TRUE, na.strings = c("", "---NA---"), nrows=12538, colClasses="character", quote=""))
  class(Isotigs_Table$Length)<-"numeric"
  class(Isotigs_Table$Cys)<-"numeric"
  output$mytable1 = renderDataTable(Contigs_Table, options = list(pageLength = 5))
  output$mytable2 = renderDataTable(Isotigs_Table, options = list(pageLength = 5))
}

shinyApp(ui, server)

用户界面

ui <- fluidPage(
  title = "Summary of de novo assembly annotations",
  mainPanel(
    tabsetPanel(
      id = 'dataset',
      tabPanel("Contigs", DT::dataTableOutput("mytable1")),
      tabPanel("Isotigs", DT::dataTableOutput("mytable2"))
    )
  )
)

服务器

server <- function(input, output) {
  source("Data.R")
  class(Contigs_Table$Length)<-"numeric"
  class(Contigs_Table$Cys)<-"numeric"
  class(Isotigs_Table$Length)<-"numeric"
  class(Isotigs_Table$Cys)<-"numeric"
  output$mytable1 = renderDataTable(Contigs_Table, options = list(pageLength = 5))
  output$mytable2 = renderDataTable(Isotigs_Table, options = list(pageLength = 5))
}

数据

Contigs<-reactiveValues(Contigs_Table=read.table("Data/annotations_expanded_CONTIGS.txt", header= TRUE, sep = "\t", fill = TRUE, na.strings = c("", "---NA---"), nrows=7467, colClasses="character", quote=""))
Isotigs<-reactiveValues(Isotigs_Table=read.table("Data/Annotation_summary_expanded_ISOTIGS", header= TRUE, sep = "\t", fill = TRUE, na.strings = c("", "---NA---"), nrows=12538, colClasses="character", quote=""))

我已按照多次讨论的说明进行操作,例如将文件添加到子文件夹(它们也已上传)和使用 reactiveValues。我稍微改变了语法(有和没有点等),但仍然没有任何效果。

【问题讨论】:

  • 另外,是否有人知道发布此类材料的更好平台?这个是有偿的!..
  • 有错误信息吗?
  • @user8383881 无。如上所述:这些表在本地渲染得很好,但在服务器中却没有。我相信你可以在链接中看到。我认为正确索引文件存在一个微不足道的问题,但我已经尽我所能进行了测试,但无济于事。
  • 把“/”放在Data前面怎么样?我假设您的数据在此 Data 子文件夹中?
  • 确认,有 2 张桌子可见!

标签: r datatables shiny publish htmlwidgets


【解决方案1】:

:) 把“/”放在数据前面怎么样?我假设您的数据在此数据子文件夹中?

【讨论】:

  • 谢谢!我知道这看起来很明显,但我在将“/”或“./”添加到数据脚本之前尝试过,但它不起作用。最后我意识到我必须将“./”添加到 both main 脚本文件和要在部署中上传的 Data 中。然后它起作用了。
  • 如果您知道此界面的更易于访问的替代方案,请告诉我。在闪亮的服务器中,作为免费用户,我每月只能显示 24 分钟。我认为 html 会提供类似的界面(例如使用 plotly),但我无法设计它。
猜你喜欢
  • 1970-01-01
  • 2017-07-28
  • 2019-12-08
  • 1970-01-01
  • 2019-04-07
  • 1970-01-01
  • 2018-07-02
  • 2016-09-04
  • 1970-01-01
相关资源
最近更新 更多