In order to reproduce the results of this project we need to follow the following steps to run the code using the same environment:
Install docker by installing Docker Desktop or just the Docker Engine if Linux is your operating system. I used this article as a guide to complete the task on debian 12.
Install git.
- Download the image related with this project.
- Select the parent directory to save your project and confirm its path by running.
- Create a directory to save the installed packages.
- Create other directory to cache installed packages.
- Download the repo by running
git clone
or downloading as a zip.
- Update the
docker-compose.yml
file with your parent directory path.
services:
taxi_project:
image: angelfelizr/project.nyc.taxi:0.0.0.9000
container_name: TaxiProject
environment:
- DISABLE_AUTH=true
- RENV_PATHS_CACHE=/home/rstudio/.cache/R/renv/library/project.nyc.taxi-dd1eca8a/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu
ports:
- "127.0.0.1:5555:8787"
volumes:
- [parent directory path]:/home/rstudio
- [parent directory path]/r-lib-4.4:/usr/local/lib/R/site-library
- [parent directory path]/cache_4.4:/home/rstudio/.cache/R/renv/library/project.nyc.taxi-dd1eca8a/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu
- After creating both folders we can run our container by running the next command based on your working directory.
Then you can go to your favorite browser and go to localhost:5555. This address is used to access the RStudio Server interface running in the Docker container.
Click over
~/project.nyc.taxi/project.nyc.taxi.Rproj
to open the project.Open an R console or an R script in the RStudio interface.
Install the packages used:
renv::restore()
- To reproduce the analysis presented, we have two alternatives:
- Using the function
devtools::build_rmd()
to render each article without installing the library.
devtools::build_rmd("vignettes/01-data-collection-process.Rmd")
- Installing the local library to be able to run the code in an interactive session.
devtools::install_local()
- When you’re done with your work and want to stop the container, you can use the following command:
Note: Make sure to save your work before stopping the container.