title: How to create a variable hyperlink in an R Shiny App
body: <p>In my shiny app, I'm trying to create a hyperlink that opens an html file, created from an R Markdown file, to a certain section based on the current tab of the app the user is on.</p>
  
  <p>Here's an excerpt from the ui and server code I'm using.</p>
  
  <pre><code>ui &lt;- fluidPage(title = "App Title",
                  dashboardPage(title = "App Title",
                                dashboardHeader(tags$li(a(href = paste0('Help_File.html', textOutput(page), target="_blank", icon("question"), title = "Help"), class = "dropdown")),
                                dashboardSidebar(sidebarMenu(id = "tabs",
                                                             menuItem(text = 'Tab 1', tabName = 'tab1'),
                                                             menuItem(text = 'Tab 2', tabName = 'tab2'),
                                                             menuItem(text = 'Tab 3', tabName = 'tab3')
                                                             )
                                                 )
  
  server &lt;- function(input, output, session) {
  
                     output$page &lt;- renderText({
                                    if(input$tabs == 'tab1') {'#page_1'}
                                    else if (input$tabs == 'tab2') {'#page_2'}
                                    else if (input$tabs == 'tab3') {'#page_3'}
                                    else ''
                                               })
                                              }
  </code></pre>
  
  <p>When I run the app, I get the error "ERROR: cannot coerce type 'closure' to vector of type 'character'".  If I put single quotes around <code>page</code> in the <code>textOutput</code> function in the ui, the app runs but the file doesn't open.  I think either the <code>textOuput</code> function is wrong or the <code>renderText</code> function in the server is wrong but I'm not sure what the correct syntax is.</p>