-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
question: render multiple dynamic rmarkdown documents inside a shiny app? #859
Comments
knit2html() is for R Markdown v1 only (http://stackoverflow.com/q/29518223/559676) and shiny docs do not work in R Markdown v1. In theory, you should call rmarkdown::render(), but I don't think it works for child documents. What you might be able to do is
I'm not completely sure if this works. |
@yihui I'm not sure how or where to use the The goal is to render multiple files like full.Rmd that are each linked to a different menu item in the navbar. Using knitr I can use sliderInput and renderPlot but I can't use the value from the slider in renderPlot (i.e., get an error input not found). See the Statistics tab. What I do now is break the rmd file into part1.Rmd and part2.Rmd and put the code for the interactive plot in ui.R and server.R. See the Probability tab. Breaking up the file is not a big deal if there are only a few interactive elements but with many (e.g., quizzes) it is awkward. Suggestions? |
@yihui I found an approach to combine multiple rmarkdown files with iteractive elements into a shiny-site without having to split up the files into chunks. See https://github.com/vnijs/shiny-site. It works by using Shiny's renderUI functionality and evaluating the rmarkdown file with Knitr in the shinyServer environment. |
Is this still the only approach for it? |
@zippeurfou If the approach I suggested not stable? See also discussion here: http://stackoverflow.com/a/30897663/1974918 |
@vnijs Sorry I did not word it correctly. Your approach is really good and I am glad you did it. I just believe that it would be great if they include an official helper method to do so or in Rstudio to make it easier. |
+1 |
Hi there, I've done a similar approach and I was really happy as I was able to fully use the shiny inputs to get my markdown updated and performing. You can see the code here along with a question I head.
) But I am getting a message saying cannot open the connection. The logfile seems to suggest that it can't find the functions I sourced within the Markdown. |
@vnijs It looks like you were able to get this to work in your If not, would you mind closing this issue when you next have the opportunity? Thanks in advance for considering this ancient issue one more time. We're just trying to dig ourselves out of issue bankruptcy, and your assistance is much appreciated 😄 |
@alandipert We have used the approach in shiny-site with our students for a number of years now and it works, even-though perhaps a bit "hacky". Will close. |
To include an rmarkdown document with (shiny) inputs I currently break-up the Rmd file into chunks because interactive elements don't work when rendering the document from within a shiny app (AFAIK). At least, I get
input not found
if I try to use the value of a slider to make a plot (using Knitr). AndError in handlers$add(handler, key, tail) : Key / already in use
if I use rmarkdown::run(path_to_file)Example below:
Shiny code called from ui.R:
Where: 01_test.Rmd contains:
My question is related to this SO question. Comments?
http://stackoverflow.com/questions/28551267/use-multiple-r-markdown-files-in-shiny-tabs/30766806#30766806
The text was updated successfully, but these errors were encountered: