Setup a reproducible environment for R development and a way to distribute R applications using Docker
-
Start a new terminal inside the devcontainer and run
R
-
If you clone a project that already has
renv.lock
as a file, you only need to runrenv::restore()
-
If your project does not have a
renv.lock
, you should initialize the project using Renv:install.packages("renv") renv::init()
-
Install required libraries (e.g., glue):
install.packages("glue") renv::snapshot()
- Create an image:
docker build -t myapplication:0.0.1 .
- Run the application:
docker run myapplication:0.0.1