title: Installing R package from source using docker file
body: <p>I am trying to install an r package from source using the dockerfile. Like seen here (using ggplot2 for simplicity)</p>
  
  <pre><code>FROM rocker/r-ver
  
  COPY . /usr/local/src/myscripts
  WORKDIR /usr/local/src/myscripts
  
  RUN R -e 'install.packages("ggplot2_3.0.0.tar.gz", repos = NULL, type = "source")'
  
  CMD ["Rscript", "run.R"]
  </code></pre>
  
  <p>Once I build the image I get this error</p>
  
  <pre><code>&gt; install.packages("ggplot2_3.0.0.tar.gz", repos = NULL, type = "source")
  Installing package into ‘/usr/local/lib/R/site-library’
  (as ‘lib’ is unspecified)
  ERROR: dependencies ‘digest’, ‘gtable’, ‘lazyeval’, ‘plyr’, ‘reshape2’, 
  ‘rlang’, ‘scales’, ‘tibble’, ‘viridisLite’, ‘withr’ are not available for 
  package ‘ggplot2’
  * removing ‘/usr/local/lib/R/site-library/ggplot2’
  Warning message:
  In install.packages("ggplot2_3.0.0.tar.gz", repos = NULL, type = "source") 
  :&gt;
  &gt; installation of package ‘ggplot2_3.0.0.tar.gz’ had non-zero exit status
  </code></pre>
  
  <p>The files included in the docker folder can be seen <a href="https://i.stack.imgur.com/DW4FH.png" rel="nofollow noreferrer">here</a></p>
  
  <p>Does anyone know what I need to add to the dockerfile to solve (if possible) this error?</p>