I am creating my first Shiny Application in R. I am using shiny to display bivariate results from a survey I conducted. From a pair of input boxes users can choose variables from the survey, and various statistics are generated (tables, plots, etc.) allowing them to explore certain attributes of the survey data.
I want to include a link to the actual PDF survey. Right now I have written code so that the PDF survey can be linked to, by clicking on the text "Click here to download survey" which appears as helpText
, embedded in a wellPanel
, within the pageWithSidebar
. I used the following commands (in the ui.R file):
wellPanel( helpText( a("Click Here to Download Survey", href="http://www.dfcm.utoronto.ca/Assets/DFCM2+Digital+Assets/Family+and+Community+Medicine/DFCM+Digital+Assets/Faculty+$!26+Staff/DFCM+Faculty+Work+$!26+Leadership+Survey+Poster.pdf") ) )
Is there a way to automatically open this file in a new tab (of IE, Firefox, etc.)? Currently, the functionality is to open the link in the same tab as the shiny app. So you have to use the forward and backwards buttons to go from app to survey and back again.
Right now, I am right clicking the link and selecting "Open in a New Tab". Is there a way to embed this functionality into the back end code so it becomes the default.
Disclaimer: I have no real experience in html or java. I am an avid user of R. If a solution is possible, can you please try to explain where I embed the code changes in the ui.R or server.R files respectively.
Shiny applications have two components, a user interface object and a server function, that are passed as arguments to the shinyApp function that creates a Shiny app object from this UI/server pair.
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.
Adding the argument target="_blank"
to the function a()
worked perfectly. Thanks for the solution @Chase!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With