Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create URL hyperlink in R Shiny?

Tags:

r

hyperlink

shiny

My code:

library(shiny) runApp(   list(ui = fluidPage(      uiOutput("tab")     ),   server = function(input, output, session){     url <- a("Google Homepage", href="https://www.google.com/")     output$tab <- renderUI({       paste("URL link:", url)     })   }) ) 

Current output:

URL link: <a href="https://www.google.com/">Google Homepage</a>

Desired output:

URL link: Google Homepage

where Google Homepage is a clickable hyperlink.

I'm currently using the renderUI/uiOutput duo as instructed here: how to create a hyperlink interactively in shiny app?

like image 622
warship Avatar asked Feb 05 '17 00:02

warship


People also ask

How do you hyperlink in R?

Hyperlinks are created using the syntax [text](link) , e.g., [RStudio](https://www.rstudio.com) . The syntax for images is similar: just add an exclamation mark, e.g., ![ alt text or image title](path/to/image) . Footnotes are put inside the square brackets after a caret ^[] , e.g., ^[This is a footnote.] .

Is R shiny hard to learn?

Along with Shiny elements, you can use HTML elements to stylize your content in your application. In my opinion, R Shiny is very easy to learn despite how powerful the tool is. If you're working on a side project or looking to add something to your portfolio, I highly recommend trying it out.

What can R shiny do?

What is Shiny (R)? Shiny is an R package that enables building interactive web applications that can execute R code on the backend. With Shiny, you can host standalone applications on a webpage, embed interactive charts in R Markdown documents, or build dashboards.

Is R shiny a package?

Shiny is an R package that makes it easy to build interactive web apps straight from R. You can host standalone apps on a webpage or embed them in R Markdown documents or build dashboards. You can also extend your Shiny apps with CSS themes, htmlwidgets, and JavaScript actions.


1 Answers

By using paste, you're treating the url as a string. The function you want to use here is tagList:

runApp(   list(ui = fluidPage(      uiOutput("tab")     ),   server = function(input, output, session){     url <- a("Google Homepage", href="https://www.google.com/")     output$tab <- renderUI({       tagList("URL link:", url)     })   }) ) 
like image 200
DeanAttali Avatar answered Oct 03 '22 00:10

DeanAttali