使用 shinyapps.io 和 rconnect to host .Rmd 报告时遇到问题

Trouble using shinyapps.io and rconnect to host .Rmd report

我有一个 .Rmd 文件用于使用以下库的报告:lubridate、plotly、DT、pracma、plyr、dplyr、scales。我的目标是在 shinyapps.io 上托管此文档,以便我的经理可以通过 link 轻松访问它。不幸的是,当我尝试通过 运行ning 以下代码进行部署时:

rsconnect::setAccountInfo(name='myAccount',
          token='myToken',
          secret='mySecret')

library(rsconnect)

rsconnect::deployDoc('myFile.Rmd')

说部署成功了,但是加载的网页就报错了。这是我在日志中得到的:

...
...
... 
2019-08-13T02:29:26.571244+00:00 shinyapps[1080409]: Warning: Error in 
library: there is no package called 'lubridate'
2019-08-13T02:29:26.577255+00:00 shinyapps[1080409]:   151: stop
2019-08-13T02:29:26.577257+00:00 shinyapps[1080409]:   150: library
2019-08-13T02:29:26.577258+00:00 shinyapps[1080409]:   148: eval
2019-08-13T02:29:26.577258+00:00 shinyapps[1080409]:   149: eval
2019-08-13T02:29:26.577259+00:00 shinyapps[1080409]:   143: evaluate_call
2019-08-13T02:29:26.577260+00:00 shinyapps[1080409]:   142: evaluate::evaluate
2019-08-13T02:29:26.577260+00:00 shinyapps[1080409]:   141: evaluate
2019-08-13T02:29:26.577261+00:00 shinyapps[1080409]:   138: call_block
2019-08-13T02:29:26.577261+00:00 shinyapps[1080409]:   139: block_exec
2019-08-13T02:29:26.577262+00:00 shinyapps[1080409]:   137: process_group.block
2019-08-13T02:29:26.577262+00:00 shinyapps[1080409]:   134: process_file
2019-08-13T02:29:26.577262+00:00 shinyapps[1080409]:   133: knitr::knit
2019-08-13T02:29:26.577263+00:00 shinyapps[1080409]:   132: <Anonymous>
2019-08-13T02:29:26.577263+00:00 shinyapps[1080409]:   127: <reactive>
2019-08-13T02:29:26.577264+00:00 shinyapps[1080409]:   111: doc
2019-08-13T02:29:26.577264+00:00 shinyapps[1080409]:   110: shiny::renderUI
2019-08-13T02:29:26.577265+00:00 shinyapps[1080409]:   109: func
2019-08-13T02:29:26.577265+00:00 shinyapps[1080409]:    96: origRenderFunc
2019-08-13T02:29:26.577266+00:00 shinyapps[1080409]:    95: output$__reactivedoc__
2019-08-13T02:29:26.577266+00:00 shinyapps[1080409]:    15: <Anonymous>
2019-08-13T02:29:26.577267+00:00 shinyapps[1080409]:    12: fn
2019-08-13T02:29:26.577266+00:00 shinyapps[1080409]:    13: rmarkdown::run
2019-08-13T02:29:26.577267+00:00 shinyapps[1080409]:     7: connect$retry
2019-08-13T02:29:26.577268+00:00 shinyapps[1080409]:     6: eval
2019-08-13T02:29:26.577268+00:00 shinyapps[1080409]:     5: eval

就上下文而言,lubridate 是我尝试在 R 脚本中加载的第一个包。我有 运行 rconnect 代码并尝试使用发布按钮,但无济于事。

我也遵循了此线程中的建议,但也无济于事:deploy a Rmd interactive doc with Shinyapps.io

有谁知道发生了什么事吗?我是否以正确的方式完成这项任务?如果不是,应该怎么做?最后,如果我真的被搞砸了,有没有其他方法可以 easily/reliably 用于托管 .Rmd 报告?

更新:已提问者的部署日志

从我的 R 控制台:

> rsconnect::setAccountInfo(name='myAccount',
+             token='myToken',
+             secret='mySecret')
> library(rsconnect)
> rsconnect::deployDoc('myFile')
Discovering document dependencies... OK
Preparing to deploy document...
Update application currently deployed at
https://r3dp4nda.shinyapps.io/nf_subjective_measures/? [Y/n] Y
DONE
Uploading bundle for document: 1080409...DONE
Deploying bundle: 2313819 for document: 1080409 ...
Waiting for task: 638103202
  building: Processing bundle: 2313819
  building: Building image: 2452900
  building: Installing system dependencies
  building: Installing packages
  building: Installing files
  building: Pushing image: 2452900
  deploying: Starting instances
  rollforward: Activating new instances
  terminating: Stopping old instances
Document successfully deployed to https://myAccount.shinyapps.io/myFile/

来自 shinyapps.io:

2019-08-13T14:13:56.809840+00:00 shinyapps[1080409]: 
2019-08-13T14:13:56.809842+00:00 shinyapps[1080409]: Listening on http://127.0.0.1:37180
2019-08-13T14:14:03.507715+00:00 shinyapps[1080409]: 
2019-08-13T14:14:04.240749+00:00 shinyapps[1080409]: 
2019-08-13T14:14:04.240752+00:00 shinyapps[1080409]: 
2019-08-13T14:14:04.240753+00:00 shinyapps[1080409]: processing file: NF_Subjective_Measures.Rmd
2019-08-13T14:14:04.252522+00:00 shinyapps[1080409]: 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |...                                                              |   4%
2019-08-13T14:14:04.259030+00:00 shinyapps[1080409]:  $ include: logi FALSE
2019-08-13T14:14:04.252728+00:00 shinyapps[1080409]: 
2019-08-13T14:14:04.253325+00:00 shinyapps[1080409]: 
  |                                                                       
  |......                                                           |   9%
2019-08-13T14:14:04.254679+00:00 shinyapps[1080409]: label: unnamed-chunk-1 (with options) 
2019-08-13T14:14:04.256983+00:00 shinyapps[1080409]: List of 2
2019-08-13T14:14:04.258442+00:00 shinyapps[1080409]:  $ eval   : logi FALSE
2019-08-13T14:14:04.259044+00:00 shinyapps[1080409]: 
2019-08-13T14:14:04.263676+00:00 shinyapps[1080409]: 
  |                                                                       
  |........                                                         |  13%
2019-08-13T14:14:04.263722+00:00 shinyapps[1080409]:   ordinary text without R code
2019-08-13T14:14:04.263943+00:00 shinyapps[1080409]: 
  |                                                                       
  |...........                                                      |  17%
2019-08-13T14:14:04.264450+00:00 shinyapps[1080409]: label: unnamed-chunk-2 (with options) 
2019-08-13T14:14:04.252725+00:00 shinyapps[1080409]:   ordinary text without R code
2019-08-13T14:14:04.264710+00:00 shinyapps[1080409]: List of 1
2019-08-13T14:14:04.265360+00:00 shinyapps[1080409]:  $ echo: logi FALSE
2019-08-13T14:14:04.265372+00:00 shinyapps[1080409]: 
2019-08-13T14:14:04.308108+00:00 shinyapps[1080409]: Warning: Error in library: there is no package called 'lubridate'

已解决。对于其他新手,请确保您没有任何 install.packages 电话或此:

rsconnect::setAccountInfo(name='myAccount',
      token='myToken',
      secret='mySecret')

library(rsconnect)

rsconnect::deployDoc('myFile.Rmd')

在你的代码体中。