How to integrate html report into R Studio or R Markdown?


I have an *.html file as a separate data analysis result report obtained from a collaborator. I wanted to inquire if there is a way to integrate this html report into an existing R Markdown file (rmd) or a way to import into R Studio?

Thank you in advance.

1 Like

I succeeded to do this with a simple RMarkdown-generated html file in the following way.

  1. Generated the file tobeincluded.html from the standard File | New File | RMarkdown template
    This uses the pandoc convertor.

  2. I use the same convertor to convert the html file to an md file:
    $ pandoc tobeincluded.html -f html -o -t markdown_strict

  3. Include the md file as a child document in the main document:

```{r child=''}

In your case you would only do steps 2 and 3 and if this works for you is dependent on the quality of the pandoc conversion. I have no experience with converting html documents that are not generated by the RMarkdown-pandoc combination.

I referenced The RMarkdown Cookbook and Converting HTML to Markdown using Pandoc by Brian Cantoni.


@HanOostdijk perfect, thank you very much.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.