我制作了一个闪亮的应用程序,它连接到远程数据库(PostgreSQL)来提取表格,以便在我的应用程序中显示,并使用表格中的值生成用户交互式图(箱线图、散点图、直方图)。
该应用程序的另一部分是在应用程序中呈现托管在网站(例如 GitHub)上的 HTML 文件。
这是我使用的代码的一部分:
output$genotyping <- renderUI({
if (creds_reactive()$user == "Admin") {
fluidPage(useShinyjs(),
titlePanel("Github HTML file"),
mainPanel(
h3("Click this button to display/hide the html file"),
br(),
br(),
actionButton("genotype", "Click me!"),
hidden(
div(id = 'text_div',
htmlOutput("includeHTML")
) )
)
) }
else {
mainPanel(
fluidRow(
align = "center",
h3("Sorry! You don't have the permissions required to view this content.")
)
)
}
})
request <- GET("link to html file")
github.html <-content(request, as ="text")
observeEvent(input$genotype, {
toggle('text_div')
output$includeHTML <- renderText({github.html}) …Run Code Online (Sandbox Code Playgroud)