mkdir ~/mydocker
cd ~/mydocker
touch Dockerfile
library(tidystringdist)
df tidy_comb_all(iris, Species)
p tidy_stringdist(df)
write.csv(p, "p.csv")
R.Version()$version.string
FROM rocker/r-ver:3.4.4
FROM rocker/r-ver:3.4.4
RUN mkdir /home/analysis
FROM rocker/r-ver:3.4.4
RUN mkdir /home/analysis
RUN R -e "options(repos = \
list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2019-01-06/')); \
install.packages('tidystringdist')"
FROM rocker/r-ver:3.4.4
ARG WHEN
RUN mkdir /home/analysis
RUN R -e "options(repos = \
list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/${WHEN}')); \
install.packages('tidystringdist')"
FROM rocker/r-ver:3.4.4
ARG WHEN
RUN mkdir /home/analysis
RUN R -e "options(repos = \
list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/${WHEN}')); \
install.packages('tidystringdist')"
COPY myscript.R /home/analysis/myscript.R
FROM rocker/r-ver:3.4.4
ARG WHEN
RUN mkdir /home/analysis
RUN R -e "options(repos = \
list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/${WHEN}')); \
install.packages('tidystringdist')"
COPY myscript.R /home/analysis/myscript.R
CMD R -e "source('/home/analysis/myscript.R')"
docker build --build-arg WHEN=2019-01-06 -t analysis .
docker run analysis
FROM rocker/r-ver:3.4.4
ARG WHEN
RUN mkdir /home/analysis
RUN R -e "options(repos = \
list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/${WHEN}')); \
install.packages('tidystringdist')"
COPY myscript.R /home/analysis/myscript.R
CMD cd /home/analysis \
&& R -e "source('myscript.R')" \
&& mv /home/analysis/p.csv /home/results/p.csv
mkdir ~/mydocker/results
docker run -v ~/mydocker/results:/home/results analysis
ls ~/mydocker/results
p.csv
FROM rocker/r-ver:3.4.4
RUN R -e "install.packages('remotes'); \
remotes::install_version('tidystringdist', '0.1.2')"
...