Search code examples
rshinyr-markdowncloud-hostingshinyapps

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


I have an .Rmd file for a report that makes use of the following libraries: lubridate, plotly, DT, pracma, plyr, dplyr, scales. My goal is to host this document on shinyapps.io so that my manager can easily access it through a link. Unfortunately, when I try to deploy by running the following code:

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

library(rsconnect)

rsconnect::deployDoc('myFile.Rmd')

It says that the deployment was successful, but the loaded webpage just gives an error. This is what I'm getting in my log:

...
...
... 
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

For context, lubridate is the first package I attempt to load in the R script. I've both run the rconnect code and tried to use the publishing button, but to no avail.

I've also followed the suggestions in this thread, also to no avail: deploy a Rmd interactive doc with Shinyapps.io

Does anyone know what's happening? Am I even approaching this task the right way? If not, how should it be done? Finally, if I'm well and truly screwed here, is there an alternative method that can more easily/reliably be used to host an .Rmd report?

Update: deployment logs for those who have asked

from my R console:

> 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/

from 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'

Solution

  • Solved. For anyone else new to this, make sure you don't have any install.packages calls or this:

    rsconnect::setAccountInfo(name='myAccount',
          token='myToken',
          secret='mySecret')
    
    library(rsconnect)
    
    rsconnect::deployDoc('myFile.Rmd')
    

    in your code body.