ETC5513: Collaborative and Reproducible Practices

Tutorial 10

Author

Michael Lydeamore

Published

21 May 2024

🎯 Objectives

  • Learn to use git lfs to deal with large files
  • Create licenses in our repostiroies
  • Use renv to create a local library

Setting up licensed repositories

For this week’s tutorial, you’ll need a brand new repository to work in. It can be public or private.

  1. Create a new repository with your choice of name. Ensure that it has a license, a .gitignore file and a README file.
    You should select these from the repo creation menu, not by committing them yourself later.

  2. Clone the repository to your local machine

  3. Change the license file to a different one. Remember you can find licenses on choosealicense.com. Stage, commit and push your changes.

  4. Revert the commit you just made.

  1. Reset the last two commits. You should end up with your original license file back on the repo.
  1. Commit, stage and push your changes (if there are any). What do you notice?
  1. Edit the README.md file to include your name. Stage and commit (but don’t push).

  2. Amend the most recent commit to also include the course code and the tutorial number. Include an expanded commit message for the amended commit.

  1. Push your changes. Can you see the expanded commit message on GitHub?

Lightweight dependency management using renv

Inside your repo from the previous section:

  1. Create a qmd file that has a libraries code chunk, and load the dplyr and ggplot2 libraries.

  2. Stage the changes, commit and push.

  3. What are the library paths for this project?

  1. Install the renv package

  2. Initialise renv in your R seession

  1. What new files or folders have been made in your repo with this command?
  1. Using the terminal, use cd and ls to find the new files.

  2. In the terminal, check the status of your repo.

  1. Create a snapshot of your repostiory using renv::snapshot()

  2. Check the status of your repo, stage, commit and push the changes into the remote repository.

Extension: Try adding a development package from GitHub, such as the naniar package. Follow the renv workflow. Does the package get recorded? Can you see it in the lockfile? How is it recorded differently from packages on CRAN?