临文乍了了,彻卷兀若无。这篇文章主要讲述如何在Shiny app中的仪表板主体中输出数据库表?相关的知识,希望能为你提供帮助。
【如何在Shiny app中的仪表板主体中输出数据库表()】如何将数据库查询的结果输出到我闪亮的应用程序仪表板中。这是我的代码
library(shiny)
library(shinydashboard)
library(dbConnect)
library(Rmysql)
library(DBI)
library(foreign)conn <
- dbConnect(
drv = RMySQL::MySQL(),
dbname = "shinytest",
host = "localhost",
username = "root",
password = "root")rs <
- dbGetQuery(conn, "Select * from test;
") ui <
- dashboardPage(
dashboardHeader(title = "Basic dashboard"),
dashboardSidebar(),
dashboardBody())server <
- function(input, output) {}shinyApp(ui, server)
现在代码
rs <
- dbGetQuery(conn, "Select * from test")
确实在控制台窗口中提供输出,但我想在仪表板主体中输出它。我怎样才能做到这一点?答案
library(shiny)
library(shinydashboard)
library(dbConnect)
library(RMySQL)
library(DBI)
library(foreign)dbDisconnect(conn)
conn <
- dbConnect(
drv = RMySQL::MySQL(),
dbname = "apilogs",
host = "localhost",
username = "root",
password = "root")rs <
- dbGetQuery(conn, "Select * from test;
") ui <
- dashboardPage(
dashboardHeader(title = "Basic dashboard"),
dashboardSidebar(),
dashboardBody(box(tableOutput('table')
)))server <
- function(input, output) {
output$table <
- renderTable(rs)}dbDisconnect(conn)
shinyApp(ui, server)
推荐阅读
- 在Rmarkdown文档中调整嵌入式Shiny App的大小
- 在内部服务器上设置Shiny app
- 从android externel文件夹编译源代码
- 新的App Server,DB服务器,间歇性半秒延迟
- Microsoft App认证流程
- 如何防止AppBar / CommandBar截断AppBarButton的标签()
- LaunchFullTrustProcessForCurrentAppAsync杀死win32应用程序
- 适用于Android Studio的十六进制代码颜色库[关闭]
- 在android中使用外部字体