Re: IncludeHTML breaks Shiny!

2,591 views
Skip to first unread message
Message has been deleted
Message has been deleted
Message has been deleted

Bob Tao

unread,
May 18, 2016, 9:02:47 AM5/18/16
to Shiny - Web Framework for R, aous...@gmail.com
I am seeing similar problem with using includeHTML(rmarkdown::render("myMarkdown.Rmd")). It messes up other panels. Is there an option to include body only.

Basically, I want to allow user to load a file and obtain a report in html. RMarkdown seems a natural choice, as it can be run and generate a HTML or PDF file the users can print or download. However it seems to interfere with other panels.

Any help is appreciated.

Bob 



On Tuesday, May 13, 2014 at 10:08:57 PM UTC-5, Yihui Xie wrote:
Sorry, I meant includeHTML(knitr::knit2html("About.Rmd", fragment.only = TRUE)).

Basically you can put withMathJax() in any UI functions that has the
... argument, e.g. tabPanel().

Regards,
Yihui


On Tue, May 13, 2014 at 11:35 AM, Yihui Xie <yi...@rstudio.com> wrote:
> That is because you included a complete HTML file in the shiny UI, and
> you should only include the content between <body> and </body> in
> About.html.
>
> Instead of includeHTML("About.html"), I think you can try
> HTML(knitr::knit2html("About.Rmd", fragment.only = TRUE)), and you
> also need withMathJax() in ui.R to show LaTeX math expressions.
>
> knitr::knit2html() uses the markdown package, and your About.html was
> generated using rmarkdown and pandoc. At the moment it is not very
> straightforward to create an HTML fragment using the rmarkdown
> package.
>
> Regards,
> Yihui
>
>
> On Tue, May 13, 2014 at 10:59 AM, Aous Abdo <aous...@gmail.com> wrote:
>> When I try to insert an HTML page, which I produce from an Rmd file with
>> knitr, into a shiny app with the IncludeHTML in shiny, some of the fields in
>> the side panel in shiny are all wrong.
>> For example, part of the numericInput field is not visible as you can see
>> here:
>>
>> http://spark.rstudio.com/statstudio/Test/
>>
>> The scripts are available on github:
>> https://github.com/aousabdo/Test

Bob Tao

unread,
May 18, 2016, 9:27:28 AM5/18/16
to Shiny - Web Framework for R, aous...@gmail.com
I should add that when includeHTML is used, the file loader failed to work.

Xu W

unread,
May 18, 2016, 5:19:27 PM5/18/16
to Shiny - Web Framework for R, aous...@gmail.com
I have this same issue. Using "includeHTML" is breaking my upload box (and causing other issues). I'll be trouble shooting this all tomorrow and I'll report back if I find a solution.

Xu W

unread,
May 18, 2016, 6:15:54 PM5/18/16
to Shiny - Web Framework for R, aous...@gmail.com
Just an update in case someone is reading, Apparently this only happens when you have a html document embedded inside a shinydashboard tabpanel. I was able to fix the issue by manually removing the head part of my html file (everything between <head> and </head> and only including the body). Will try to figure out more soon. 

Bob Tao

unread,
May 19, 2016, 11:08:43 AM5/19/16
to Shiny - Web Framework for R, aous...@gmail.com
Looking forward to hearing your progress. I would like to use somethign like this  includeHTML(rmarkdown::render("myMarkdown.Rmd")) if there is an option to include only the body. 

Maybe we could render Markdown in one step followed by removing the head section, and then feed to includeHTML.  That seemed to work OK. Now the problem is that includeHTML("myMarkdown.html") in ui.R does not get the newly generated html file. 

Bob Tao

unread,
May 19, 2016, 11:44:04 AM5/19/16
to Shiny - Web Framework for R, aous...@gmail.com
Combined with using renderUI to provide the html file to ui as suggested by http://stackoverflow.com/questions/24875943/display-html-file-in-shiny-app seems to solve my problem!   

Bob Tao

unread,
May 19, 2016, 11:48:45 AM5/19/16
to Shiny - Web Framework for R, aous...@gmail.com
Still have issues with refreshing

Véronique Tremblay

unread,
Oct 17, 2017, 10:25:07 AM10/17/17
to Shiny - Web Framework for R
Works very well if I delete everything outside the <body> and <\body>. Thank you so much!


Margaret Siple

unread,
Jul 12, 2019, 1:14:42 PM7/12/19
to Shiny - Web Framework for R
Thank you so much for these instructions-- you just saved me a lot of grief. I appreciate both the OP and the discussion on this thread!
Reply all
Reply to author
Forward
0 new messages