首页 > 解决方案 > 如何将交互式绘图添加到 Github 上的自述文件(在 R 中生成)

问题描述

我正在用 R 编写我的第一个包,并希望最初可以在我的 Github 上使用它并最终提交给 CRAN 和/或 Bioconductor。这是我在 github 上的包的链接:https ://github.com/octaviamd/interactmapper我的包的主要功能是这些交互式绘图,您可以使用我的包生成这些交互式绘图,我希望包括其中一些作为示例我的 README 文件中的包可以做什么,但不幸的是,github 文档似乎不允许交互元素。是否有解决方法,以便我可以成功地演示我的包在 README 文件中的工作方式?

我尝试在生成的 github_document README.Rmd 中运行以下命令usethis::use_readme_rmd()

devtools::install_github("octaviamd/interactmapper")
library(interactmapper)
interactmapper::interact_qual(iris[,1:4], iris$Species, "UMAP")

但是当我尝试编织 Rmarkdown 文档时,我收到以下错误消息:

Error: Functions that produce HTML output found in document targeting gfm-ascii_identifiers 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

我不知道是否最好将 README 文件保留为 github_document 以便于在 github 上显示,或者我切换到 html 是否会使其根本不起作用或会影响我向 CRAN/Bioconductor 的提交。我尝试将该always_allow_html: yes行添加到 YAML,但是,正如错误消息所述,在编织时,它会生成文档,但根本没有我的情节。

如何在 github 上的 README 文件中成功显示我的交互式绘图?如果您以前有这方面的经验或对如何做到这一点有想法,我非常感谢您的意见!先感谢您!!

标签: rgithubinteractivecranreadme

解决方案


推荐阅读