Skip to content
/ dockerR Public template

A Research Environment with Docker & VS Code for Economists

License

Notifications You must be signed in to change notification settings

kazuyanagimoto/dockerR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My Docker-VSCode Template for R (with Python, Julia, and LaTeX)

How to use

Prerequisites (and for the first time to use this template)

Setup & Workflows

I will introduce the workflow when starting a project using this template and when working. The administrator creates a project using this template, and the collaborators clone the project and work on it.

Administrator

  1. Create Docker Volumes. (Only for the first time using this template)
docker volume create cache
docker volume create TinyTeX
docker volume create fonts
  1. Create a new repository from this template on GitHub and clone it to your local computer
  2. Open this repository in VSCode. (Remote Containers)
  3. Create an R project. If you use Rstudio, access localhost:8787 and create a project.
  4. Start package management with renv::init()
  5. Install DVC with pip install dvc dvc-gdrive. This command is not required after the second time because of the pip cache
  6. Set up the DVC environment
    • Create a folder on Google Drive and copy its ID
    • Run dvc init && dvc remote add -d myremote gdrive://<Google Drive folder ID>
    • Share the Google Drive folder with the collaborators (as a normal Google Drive folder)
  7. Set up VSCode settings for LaTeX
    • For the first time, run tinytex::install_tinytex(dir = "/home/rstudio/.TinyTeX", force = TRUE)
    • Copy .vscode/_settings.json to .vscode/settings.json
  8. Set up Julia environment. Create an empty Project.toml file and activate it with Pkg.activate().

Collaborators

  1. Create Docker Volumes. (Only for the first time using this template)
  2. Clone the repository created by the administrator on GitHub
  3. Open this repository in VSCode. (Remote Containers)
  4. Open the R project. (If you use Rstudio, access localhost:8787 and open the project.)
  5. Install the R packages with renv::restore()
  6. Install Python packages (including DVC) with pip install -r requirements.txt
  7. Download the data with dvc pull
  8. Set up VSCode settings for LaTeX
    • For the first time, run tinytex::install_tinytex(dir = "/home/rstudio/.TinyTeX", force = TRUE)
    • Copy .vscode/_settings.json to .vscode/settings.json
  9. Install Julia packages with Pkg.activate(); Pkg.instantiate()

During Work

  1. When you add an R package, record it with renv::snapshot()
  2. When you add a Julia package, add it with Pkg.add("Package Name"). It will be automatically recorded in Project.toml
  3. When you add a Python package, add it with pip install Package Name and record it with pip freeze > requirements.txt
  4. When you add data with DVC, add it with dvc add. Usually, just add the directory with dvc add data/
  5. After the above work, git add, git commit, and git push
  6. When you finish the work, upload the data with dvc push

About

A Research Environment with Docker & VS Code for Economists

Resources

License

Stars

Watchers

Forks

Releases

No releases published