繁体   English   中英

R闪亮表未渲染

[英]R shiny table not rendering

我正在尝试使用renderTable创建一个表,但它不在浏览器上呈现。 这是SS @ imgur

完整表格的代码

这是renderTable代码:

library(shiny)
library(diceR)

output$clustensemble <- renderTable({
#load file
data <- data()

#consensus cluster
cc <- consensus_cluster(data, nk=3, reps=1, algorithms=c("km","hc"), progress=FALSE)
ce <- as.matrix(cc)
tce <- t(ce)
tce })

我试过使用

sanitize.text.function = function(x)x;

但它没有工作,在规定位置

我也尝试过使用renderUI,但是它会生成另一个错误。

该表由数字和字符串组成,但是我认为这不是问题。 在这种R项目中还是一个新手,所以我不知道任何其他解决方案。 我该怎么办,导致此问题的原因是什么? 谢谢!

(编辑)

样本数据csv

用户界面

服务器

应用程序

在没有看到您使用的数据和用户界面的情况下,我们只能猜测。 使用来自diceR的示例数据,我可以使用基本shinyDT打印出表格。

library(shiny)
library(DT)
library(diceR)

data(hgsc)
# Custom distance function
manh <- function(x) {
  stats::dist(x, method = "manhattan")
}
# Custom clustering algorithm
agnes <- function(d, k) {
  return(as.integer(stats::cutree(cluster::agnes(d, diss = TRUE), k)))
}
assign("agnes", agnes, 1)

ui <- fluidPage(
  DT::dataTableOutput("tableDT"),
  tableOutput("table")
)

server <- function(input, output){

  data <- reactive({
    dat <- hgsc[1:10, 1:50]
    cc <- consensus_cluster(dat, reps = 6, algorithms = c("pam", "agnes"),
                            distance = c("euclidean", "manh"), progress = FALSE)
    ce <- as.matrix(cc)
    t(ce)
  })

  output$tableDT <- DT::renderDataTable({
    data()
  })

  output$table <- renderTable({
    data()
  })
}

shinyApp(ui, server)

暂无
暂无

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

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