在 R Shiny 标题中制作图像超链接

Jam*_*ssy 5 html r hyperlink shiny

我一直在尝试将图像输出超链接到网站,但我在仔细阅读有关堆栈溢出的其他问题时遇到了麻烦

svg 带有闪亮的可点击链接 - 不可点击

http://www.invisiblecompany.com/shiny%20parts/archives/2004/11/clickable-logo.php

http://www.leahkalamakis.com/add-an-image-to-your-sidebar-make-it-clickable/

标签不起作用

服务器文件

library(shiny)
library(png)


server <- shinyServer(function(input, output) { 

output$image1 <- renderImage({
  width<- "100%"
  height<- "100%"
list(src = "www/logo.png",
     contentType = "image/png",
     width = width,
     height = height,
)

}, deleteFile = FALSE)
output$text1 <- renderText({ "please help make the image hyperlinked"     })


})
Run Code Online (Sandbox Code Playgroud)

用户界面

library(shiny)



ui <- shinyUI(pageWithSidebar(
 titlePanel(imageOutput("image1")),

sidebarPanel(
  helpText(   a("Click Here for the Source Code on Github!",         href="https://github.com/Bohdan-Khomtchouk/Microscope",target="_blank"))

 ),
 mainPanel(
tabsetPanel(


  tabPanel("Instructions",textOutput("text1"))
))
))
Run Code Online (Sandbox Code Playgroud)

你可以用你想要的任何东西替换 logo.png 我认为超链接在服务器的列表中。

Car*_*arl 5

只需在 UIimageOutput中用tags$aso换行即可:

titlePanel(tags$a(imageOutput("image1"),href="https://www.google.com"))
Run Code Online (Sandbox Code Playgroud)

如果你想从服务器端定义网页,那么你需要这样的东西:

#server
  output$example <- renderUI({
    tags$a(imageOutput("image1"),href="https://www.google.com")
  })
#UI
titlePanel(uiOutput("example"))
Run Code Online (Sandbox Code Playgroud)