/ / Wie bekomme ich R's install.packages in einem Dockerfile? - r

Wie bekomme ich install.packages von R in einem Dockerfile? - r

Unten ist ein Befehl, der fehlgeschlagen ist, aber Docker behieltgehen. Ich bin mir ziemlich sicher, dass die "Warnung" ("Installation hatte einen Exitcode ungleich Null") nicht als Exitcode ungleich Null an den Aufruf von Rscript übergeben wurde.

Wie bekomme ich das, um den Docker-Build zu stoppen?

Step 21/44 : RUN Rscript -e "install.packages("https://cran.rstudio.com/src/contrib/prophet_0.1.tar.gz", dependencies=TRUE)"
---> Running in 26ba0c1da37c
Installing package into ‘/usr/local/spark-1.6.1-bin-hadoop2.6/R/lib’
(as ‘lib’ is unspecified)
inferring "repos = NULL" from "pkgs"
trying URL "https://cran.rstudio.com/src/contrib/prophet_0.1.tar.gz"
Content type "application/x-gzip" length 75619 bytes (73 KB)
==================================================
downloaded 73 KB

ERROR: dependencies ‘extraDistr’, ‘rstan’ are not available for package ‘prophet’
* removing ‘/usr/local/spark-1.6.1-bin-hadoop2.6/R/lib/prophet’
Warning message:
In install.packages("https://cran.rstudio.com/src/contrib/prophet_0.1.tar.gz",  :
installation of package ‘/tmp/RtmpAa2XQV/downloaded_packages/prophet_0.1.tar.gz’ had non-zero exit status

Antworten:

2 für die Antwort № 1

Sie können erzwingen, dass Warnungen als Fehler behandelt werden (d. H. Sofortiges "Stoppen") options(warn = 2). Von ?options:

 "warn": sets the handling of warning messages.  If "warn" is
negative all warnings are ignored.  If "warn" is zero (the
default) warnings are stored until the top-level function
returns.  If 10 or fewer warnings were signalled they will be
printed otherwise a message saying how many were signalled.
An object called "last.warning" is created and can be printed
through the function "warnings".  If "warn" is one, warnings
are printed as they occur.  If "warn" is two or larger all
warnings are turned into errors.