# Using specific versions of R packages in docker file

**URL:** <https://support.openanalytics.eu/t/using-specific-versions-of-r-packages-in-docker-file/763>\
**Category:** ShinyProxy\
**Created:** [October 3, 2018, 11:01am UTC](https://support.openanalytics.eu/t/using-specific-versions-of-r-packages-in-docker-file/763 "2018-10-03T11:01:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Timothy\_D](https://support.openanalytics.eu/letter_avatar_proxy/v4/letter/t/d9b06d/32.png) [@Timothy\_D](https://support.openanalytics.eu/u/Timothy_D)\
**Post date:** [October 3, 2018, 11:01am UTC](https://support.openanalytics.eu/t/using-specific-versions-of-r-packages-in-docker-file/763/1 "2018-10-03T11:01:48Z")

</div>

Hi everyone, I’m new to Shiny Proxy and am doing my best, yet have recently run into an obstacle. I’ve prepared a docker file and am attempting to spin up an image. I need to use specific versions for several packages. I’ve tried to use the install\_version() command, from the devtools package, but I get the following error.

**Error: unexpected numeric constant in “install\_version(‘readxl’, version = 1.0.0”**  
**Execution halted**  
**The command '/bin/sh -c R -e "install\_version(‘readxl’, version = “1.0.0”, dependencies= T, repos='[https://cloud.r-project.org/‘)"’](https://cloud.r-project.org/')%22') returned a non-zero code: 1**

The docker file that produces this error is as follows:

> FROM openanalytics/r-base
> 
> MAINTAINER John Smith “exampleemail”
> 
> # system libraries of general use
> 
> RUN apt-get update && apt-get install -y   
> sudo   
> pandoc   
> pandoc-citeproc   
> libcurl4-gnutls-dev   
> libcairo2-dev   
> libxt-dev   
> libssl-dev   
> libssh2-1-dev   
> libssl1.0.0
> 
> # system library dependency for the TSK app
> 
> RUN R -e “install.packages(c(‘hms’,‘devtools’))”
> 
> RUN R -e “require(devtools)”
> 
> RUN R -e “install\_version(‘readxl’, version = “1.0.0”, dependencies= T)”  
> RUN R -e “install\_version(‘DT’, version = “0.2”, dependencies= T)”  
> RUN R -e “install\_version(‘shinydashboard’, version = “0.6.1”, dependencies= T)”  
> RUN R -e “install\_version(‘knitr’, version = “1.18”, dependencies= T)”  
> RUN R -e “install\_version(‘magrittr’, version = “1.5”, dependencies= T)”  
> RUN R -e “install\_version(‘ggrepel’, version = “0.7.0”, dependencies=T)”  
> RUN R -e “install\_version(‘dplyr’, version = “0.7.4”, dependencies=T)”  
> RUN R -e “install\_version(‘Rcpp’, version = “0.12.14”, dependencies=T)”  
> RUN R -e “install\_version(‘rhandsontable’, version = “0.3.4”, dependencies=T)”  
> RUN R -e “install\_version(‘shinyjs’, version = “0.9.1”, dependencies=T)”  
> RUN R -e “install\_version(‘V8’, version = “0.2.0”, dependencies=T)”  
> RUN R -e “install\_version(‘data.table’, version = “1.10.4-3”, dependencies=T)”  
> RUN R -e “install\_version(‘packrat’, version = “0.4.8-1”, dependencies=T)”  
> RUN R -e “install\_version(‘zoo’, version = “1.8-1”, dependencies=T)”  
> RUN R -e “install\_version(‘shiny’, version = “1.0.5.9000”, dependencies=T)”  
> RUN R -e “install\_version(‘rmarkdown’, version = “1.8”, dependencies=T)”  
> RUN R -e “install\_version(‘kableExtra’, version = “0.3.0”, dependencies=T)”
> 
> # copy the app to the image
> 
> RUN mkdir /root/tsk  
> COPY tsk /root/tsk
> 
> COPY Rprofile.site /usr/lib/R/etc/
> 
> EXPOSE 3838
> 
> CMD [“R”, “-e”, “shiny::runApp(‘/root/tsk’)”]

I would be so grateful for any advice with this (please note that I deleted the  
**repos = [https://cloud.r-project.org/](https://cloud.r-project.org/)** argument for the install\_version() calls above, because new users can only include 2 hyperlinks in a post entry here).

With warm wishes,

Tim

---

<div class="post-metadata">

**Author:** ![mnazarov](https://support.openanalytics.eu/user_avatar/support.openanalytics.eu/mnazarov/32/216_2.png) [@mnazarov](https://support.openanalytics.eu/u/mnazarov)\
**Post date:** [October 4, 2018, 10:40am UTC](https://support.openanalytics.eu/t/using-specific-versions-of-r-packages-in-docker-file/763/2 "2018-10-04T10:40:27Z")

</div>

Hello Tim,  
You get the error because you have used double quotes inside double quoted string.  
So it can easily be fixed by replacing  
`RUN R -e "install_version('readxl', version = "1.0.0", dependencies= T)"`  
lines with  
`RUN R -e "install_version('readxl', version = '1.0.0', dependencies= T)"`

---

<div class="post-metadata">

**Author:** ![Timothy\_D](https://support.openanalytics.eu/letter_avatar_proxy/v4/letter/t/d9b06d/32.png) [@Timothy\_D](https://support.openanalytics.eu/u/Timothy_D)\
**Post date:** [October 7, 2018, 11:47am UTC](https://support.openanalytics.eu/t/using-specific-versions-of-r-packages-in-docker-file/763/3 "2018-10-07T11:47:36Z")

</div>

Thanks so much Maxim, I really appreciate it :)😀
