Search code examples
rshinyrcppdplyrggvis

R Shiny app using ggvis gives error during upload


I'm trying to host shiny apps that use the ggvis library on shinyapps.io. When uploading my app, the runApp() function fails when building the required packages to host the app. The error occurs when installing dplyr, which is used by ggvis. Dplyr in turn uses Rcpp, and the correct version is not retrieved from RCRAN, although it is available.

Can someone help me out here? Is there any way to specify package versions manually to circumvent this issue?

R code and steps needed to reproduce issue:

## ui.R
shinyUI(bootstrapPage(
  ggvisOutput("p"),
  uiOutput("p_ui")
))

## server.R
shinyServer(function(input, output, session) {
  input_width <- reactive(input$width)

  mtcars %>% 
    ggvis(~mpg) %>% 
    layer_histograms(width = input_width) %>%
    bind_shiny("ggvis", "ggvis_ui")
})


## When located in folder with ui.R and server.R file:
library("shiny")
library("shinyapps")
deployApp() # command that fails

Excerpt of the error:

...
[2014-10-28T16:05:00.464944786+0000] Building R package: dplyr (0.3.0.2)
/mnt/packages/build /mnt
* installing to library ‘/usr/local/lib/R/site-library’
* installing *source* package ‘dplyr’ ...
** package ‘dplyr’ successfully unpacked and MD5 sums checked
** libs
Error: package ‘Rcpp’ 0.11.2 was found, but >= 0.11.3 is required by ‘dplyr’
* removing ‘/usr/local/lib/R/site-library/dplyr’
################################### End Log ################################### 
Error: Unhandled Exception: Child Task 2477816 failed: Error building image: Error building dplyr (0.3.0.2). Build exited with non-zero status: 1
Execution halted

Session info:

> sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252        LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base 

Solution

  • The message

    Error: package ‘Rcpp’ 0.11.2 was found, but >= 0.11.3 is required by ‘dplyr’

    indicates that you are using an older version of R (maybe 3.0.2 ?) which searches in a tree containing only Rcpp 0.11.2.

    The fix is simple: upgrade R. Then install your dependencies, including the latest version of Rcpp with install.packages("Rcpp").