R亮表不渲染
我正在尝试使用Renderable创建一个表,但它没有在浏览器上进行渲染。这是党卫军 @ 满桌的 这是可渲染代码:R亮表不渲染,r,shiny,R,Shiny,我正在尝试使用Renderable创建一个表,但它没有在浏览器上进行渲染。这是党卫军 @ 满桌的 这是可渲染代码: 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"),
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 })
库(闪亮)
图书馆(diceR)
输出$clustensemble而不查看您使用的数据和ui,我们只能猜测。
使用diceR
中的示例数据,我能够使用baseshinny
或DT
打印出一个表
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)
库(闪亮)
图书馆(DT)
图书馆(diceR)
数据(hgsc)
#自定义距离函数
曼恩,请提供更多的代码(在R,而不是HTML)与样本数据我已经添加了他们,请评估,谢谢。我已经编辑了我的文章,请。我会尝试你的解决方案,但它不起作用,似乎是数据造成的问题。它与stats::dist(x=x,method=dist)中的错误警告相关:强制引入的NAs
您在clustensemble
的ui中没有tableOutput
,或者我认为这是错误的?我看到的只是一个逐字输出
,这对于表来说是错误的方法。。