3

I am currently trying to build an R shiny dashboard and i want to create parts where i link to websites and give information around them. I initially started the dashboard offline and simply ran a script making the URL a string, then used that later. I want to host it on shiny now and I cant get R to run the strings first so think i need to do it another way.

My first attempt at the dashboard is below:

  dashboardHeader(title = "dashboard"),
  dashboardSidebar(
    sidebarMenu(
      menuItem("ex1?", tabName = "ex1", icon = icon("arrow-circle-right")),
      menuItem("ex2", tabName = "queries", icon = icon("envelope")),
      menuItem("ex3", tabName = "QMI", icon = icon("folder-open")),
      menuItem("ex4", tabName = "Newport", icon = icon("arrow-circle-right"))
    )
),
  dashboardBody(
    tabItems(
      tabItem(tabName = "Main",
              h3("What we do?", tags$br(),
              h4(box("text")
),
              tabBox(
              title = "Core publications",
              id = "tabset1", height = "200px", width = 5,
              tabPanel("link1", tagList(link1_url),tags$br(),"text"),
              tabPanel("link2",tagList(link2_url),tags$br(), "text"),
              tabPanel("link3",tagList(link3_url),tags$br(), "text3")
),

The string file has e.g.

ex1_url <- a("text", href="https://www.exampleurl.com")

So with the current code, when the dashboard is live it crashes since it doesnt have the destination for the hyperlinks, i need a way to link the background url to the text in the ui.

I feel i haven't set this up the best way so any help will be appreciated.

Thanks

Alan.E
  • 31
  • 1
  • 2
  • 2
    see this https://stackoverflow.com/questions/42047422/create-url-hyperlink-in-r-shiny – Chabo Jan 14 '19 at 16:21
  • Thank you for this, I have looked at this answers before. I am not sure how to edit my code so that is uses ```renderUI/uiOutput``` shown in it? – Alan.E Jan 15 '19 at 08:31
  • Where do you want to URL in your dashboard? In the example the user is outputting to an object labeled "tab", you could add a `uiOutput` anywhere in your ui, `uiOutput("url")` and then output to it in the server, `output$url <- renderUI({ tagList("URL link:", url) })` – Chabo Jan 15 '19 at 15:13

0 Answers0