如何在屏幕上显示R交叉表
我的服务器.R如何在屏幕上显示R交叉表,r,shiny,R,Shiny,我的服务器.R shinyServer(function(input, output) { output$table0 <- renderPrint({ confusionMatrix(sms_results$predict_type, sms_results$actual_type, positive = "spam") }) output$table <- renderDataTable({ table(sms_results$ac
shinyServer(function(input, output) {
output$table0 <- renderPrint({
confusionMatrix(sms_results$predict_type,
sms_results$actual_type, positive = "spam")
})
output$table <- renderDataTable({
table(sms_results$actual_type, sms_results$predict_type)
})
output$table1 <- renderDataTable({
CrossTable(sms_test_pred, sms_test_labels,
prop.chisq = FALSE, prop.t = FALSE, prop.r = FALSE,
dnn = c('predicted', 'actual'))
})
那么,如何在shiny中查看外部交叉表和混淆矩阵呢?假定所有全局变量都已加载,并使用此代码运行应用程序
uir.r
library(shiny)
shinyUI(fluidPage(
# Application title
titlePanel("Machine Learning - Evaluating Model Performance"),
br(),br(),
sidebarLayout(
sidebarPanel(
h2("Davin", align = "center"),
h2("(>..<)", align = "center", style = "color:blue"),
img(src = "40.png", height = 150, width = 300,style="display: block; margin-left: auto; margin-right: auto;")
),
mainPanel(
plotOutput("plot"),
column(12,dataTableOutput('table')),
h2("Kappa Table", align = "center"),verbatimTextOutput('tabkapp'),
h2("xTable", align = "center"),verbatimTextOutput('table1'),
h2("ROC prob", align = "center"),
column(12,dataTableOutput('tables'))
))))
# column(12,tableOutput('tables'))
shinyServer(function(input, output) {
output$table1 <- renderPrint({
ctab <- CrossTable(sms_test_pred, sms_test_labels,
prop.chisq = FALSE, prop.t = FALSE, prop.r = FALSE,
dnn = c('predicted', 'actual'))
})
output$tabkapp <- renderPrint({
tbkp <- Kappa(table(sms_results$actual_type, sms_results$predict_type))
tbkp
})
})
到web外部视图
有什么办法让它变得更好吗?它是ascii风格的(我想)。。。我希望它像“datatableoutput”
我很好这个问题我不清楚。这是(a)关于如何在Shining中显示表,还是(b)关于如何将数据导入Shining,还是(c)关于CrossTable confusionMatrix函数?请参阅和,以获取有关如何提出好问题以及如何提供最小、完整和可验证的示例的建议。如果您使用的是
renderDataTable
,则它必须是DT
对象。您可以使用datatable(您拥有的任何其他表对象)
。也许可以看看文档。如何在外部视图中在web上显示它,我也很困惑,因为它不是一个表,而是一个xtable…没有适用于“Confusionmatrix”类对象的“xtable”方法错误是这样的
shinyServer(function(input, output) {
output$table1 <- renderPrint({
ctab <- CrossTable(sms_test_pred, sms_test_labels,
prop.chisq = FALSE, prop.t = FALSE, prop.r = FALSE,
dnn = c('predicted', 'actual'))
})
output$tabkapp <- renderPrint({
tbkp <- Kappa(table(sms_results$actual_type, sms_results$predict_type))
tbkp
})
})