hosting HTML pages on shiny-server

953 views
Skip to first unread message

Edith Invernizzi

unread,
May 4, 2017, 8:51:23 AM5/4/17
to Shiny - Web Framework for R
I have used a combination of shiny and rmarkdown to build a website, in which the shiny app makes the search feature filtering results from a large database. Every result is linked by name to a detailed page where more information is provided. In practice, the app returns a result table in which each row of the name column is a link to the specific info page.

It seems however that shiny-server (installed on our server) does not allow hosting of html pages, so the link to the info page is broken -Not Found .

Alternatively, I am trying to render the info-page as a general rmarkdown page that is rendered with result-specific information every time it is called. Unfortunately, there does not seem to be a way to pass down information through a link to a general rmarkdown document. In practice, what I want to implement: clicking on the result 'My result', a generic .rmd document is called and the same link passes down the name 'My result' to the .rmd so that it can retrieve 'My result'- specific information before being knitted.



Is there a solution to this using shiny-server?

Thanks,

Edith

Joe Cheng

unread,
May 4, 2017, 12:30:38 PM5/4/17
to Edith Invernizzi, Shiny - Web Framework for R
Both of these should be possible. For hosting html pages on shiny-server, where did you place the files and what URL did you attempt to access them with?

For the knitting, you can try the parameterized reports feature of R Markdown: http://rmarkdown.rstudio.com/developer_parameterized_reports.html

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/8cbf1373-d0d4-47f3-a455-ef9c227134ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted

Edith Invernizzi

unread,
May 16, 2017, 10:59:59 AM5/16/17
to Shiny - Web Framework for R, inve...@gmail.com
On Wednesday, 10 May 2017 , Joe Cheng [RStudio] wrote:

By default, Shiny doesn't expose files you put in the app directory to web browsers. This is because many authors need these files to stay private; the code and data that's behind the app may be proprietary or otherwise sensitive. If you want to expose files for public access, you have to use one of two methods:
  1. In your app directory, create a subdirectory called "www". Anything in this subdirectory will be available to the browser; however, do NOT include "www" in the URL path. So for example, www/foo.png would be referred to with <img src="foo.png">, and www/images/bar.png would be <img src="images/bar.png">.
  2. Keep your custom subfolder (e.g. htmlfolder) and use shiny::addResourcePath("htmlfolder", "htmlfolder") to explicitly ask Shiny to make this folder available to the browser.

Edith Invernizzi

unread,
May 16, 2017, 12:03:53 PM5/16/17
to Shiny - Web Framework for R
he www folder works perfectly.

Regarding the knitting, I am assuming that, if I want the .rmd page to be knitted with the specific information, my code will look something like this: 

(working with the DT package to make the .rmd file knit on table row click)

 output$tableSubset=DT::renderDataTable({
   rown=input$res_rows_selected
      fullTable=res.table()         #subset of information used in output table above
      nm=as.character(fullTable[rown,"name"])
      
      rmarkdown::render("MyDocument.Rmd", params = list(
  name = nm
))
  })


My question is: once the user clicks on the table row, will the newly-knitted MyDocument.rmd be opened in another page by default?
- show quoted text -
Reply all
Reply to author
Forward
0 new messages