Skip to content

Commit

Permalink
Merge pull request #53 from microbiomedata/50-upgrade-package-version…
Browse files Browse the repository at this point in the history
…s-in-renv-to-resolve-gcc-errors-during-environment-setup-on-ubuntu

Refactor R package management system and clean up R dependencies
  • Loading branch information
kheal authored Jul 9, 2024
2 parents b18677c + 47df1f2 commit eadf539
Show file tree
Hide file tree
Showing 5 changed files with 351 additions and 338 deletions.
19 changes: 16 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,26 @@ _or_

### R

This project uses `renv` for package management. After cloning the github repository, open the R project and run `renv::restore()` to make sure your packages match. To learn more about how renv works, [see this resource](https://rstudio.github.io/renv/articles/renv.html).
This project uses `renv` for package management. We maintain a libraries.R mini script that calls the necessary packages for the project for local development because renv does not track library calls withing .ipynb files (only.R or .Rmd files).

#### To install the R dependencies:

1. Clone the github repository
2. Open the R project
3. Run `renv::restore()` to make sure your packages match. To learn more about how renv works, [see this resource](https://rstudio.github.io/renv/articles/renv.html).

#### To add new R dependencie:

1. Install the library with `renv::install("package_name")`.
2. Add the package to the libraries.R file so that `renv` can track it (e.g. `library("package_name")`.
3. Run `renv::snapshot()` to update the lockfile.
4. Commit changes and push to github.

### Python

This project uses pip paired with venv to manage dependencies. Note that requirements_dev.txt should be used and updated for local development dependencies, and requirements.txt should be used for production/binder dependencies (updated manually and with discretion).

#### To install the dependencies:
#### To install the python dependencies:

1. Clone the github repository
2. create a virtual environment:
Expand All @@ -111,7 +124,7 @@ This project uses pip paired with venv to manage dependencies. Note that require
**Note** to update your package installations:
`pip install -U -r requirements_dev.txt`

#### To add new packages:
#### To add new python dependencies:

1. Activate the virtual environment:
`source venv/bin/activate`
Expand Down
3 changes: 2 additions & 1 deletion .renvignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.ipynb
*.ipynb
venv/*
9 changes: 9 additions & 0 deletions libraries.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file contains the libraries that are used in the R juptyer notebooks to facilitate reproducibility using the renv package.

library(jsonlite)
library(dplyr)
library(tidyr)
library(ggplot2)
library(forcats)
library(lubridate)
library(GGally)
Loading

0 comments on commit eadf539

Please sign in to comment.