使用 Shinyapps.io 部署 Rmd 交互式文档 [英] deploy a Rmd interactive doc with Shinyapps.io

查看:57
本文介绍了使用 Shinyapps.io 部署 Rmd 交互式文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试部署一个闪亮的应用程序,但遇到了麻烦......

I am trying to deploy a shiny app and am running into trouble...

我有一个 Rmd 文件,我试图首先通过在 Rstudio 本地运行,然后在 Web 上运行来发布此文档.我的文件存储在我的主用户目录中名为 Shiny 的文件夹中.这有导入的文件、我的 RMD、我的 Shinyapps.io 文件和我的 rsconnect 文件.

I have an Rmd file, and am trying to publish this document first by running locally in Rstudio, then on web. My files are stored on my home user directory in a folder named Shiny. This has the files imported, my RMD, my shinyapps.io file, and my rsconnect file.

  • title:久坐分析"
  • 作者:比安卡·冈萨雷斯"
  • 日期:2016 年 7 月 26 日"
  • 输出:html_document
  • 运行时:闪亮

当我运行 rsconnect::deployApp('SedentaryAnalysis.Rmd') 文件时,我得到:文档已成功部署到 https://biancagonzalez.shinyapps.io/SedentaryAnalysis/

When I run the rsconnect::deployApp('SedentaryAnalysis.Rmd') file I get: Document successfully deployed to https://biancagonzalez.shinyapps.io/SedentaryAnalysis/

但是,当我打开链接时,出现错误:

However when I open my link, I get the error:

感谢您帮助我了解此错误.

Thanks for helping me understand this error.

比安卡 G

推荐答案

当您调用 rsconnect::deployApp('SedentaryAnalysis.Rmd') 时,它只会部署那个文件 (SedentaryAnalysis.Rmd).您的 .Rmd 中可能包含引用其他文件的代码.这些文件也需要部署,以便您的代码在 Shinyapps.io 上工作.您需要执行以下操作:

When you call rsconnect::deployApp('SedentaryAnalysis.Rmd'), it only deploys that one file (SedentaryAnalysis.Rmd). Your .Rmd probably has code in it that refers to other files. Those files need to be deployed too for your code to work on shinyapps.io. Here is what you need to do:

  1. 用相对路径替换文档中的任何绝对路径.

  1. Replace any absolute paths in your document with relative ones.

调用 rsconnect::deployDoc(...) 而不是 rsconnect::deployApp(...).这将告诉 RStudio 查找您在文档中使用的文件并将它们与文档一起部署.

Call rsconnect::deployDoc(...) instead of rsconnect::deployApp(...). This will tell RStudio to look for the files you use in the document and deploy them with the document.

如果您使用的是 RStudio,它的发布"按钮将为您完成大部分工作,因此请尝试在工具栏中单击该按钮.

If you're using RStudio, its Publish button will do most of this for you, so try clicking that in the toolbar.

这篇关于使用 Shinyapps.io 部署 Rmd 交互式文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆