Error: Functions that produce HTML output found in document targeting docx output. Please change the output type of this document to HTML. Alternatively, you can allow HTML output in non-HTML formats by adding this option to the YAML front-matter of your rmarkdown file: always_allow_html: yes Note however that the HTML output will not be visible in non-HTML formats. Execution halted"
No, you cannot embed the HTML figure in a Word document. An interactive plotly plot is HTML, and so it works fine with HTML output R Markdown files, but it won't work when rendering to Word or PDF format outputs. You can either consider changing the output format to HTML, or include a static figure instead of the plotly object. I think by default knitr will take a snapshot of the figure and embed the static version, but not entirely sure if this will happen for plotly figures (and you may also need webshot or another tool to allow this to work).