Day 2

Day 2:

  1. Portable file paths with here
  2. Using git and GitHub (setup instructions)
  3. Creating a research compendium

Does git sound familiar to you?

😯 I don’t have a clue

πŸ‘ I’ve heard of it

πŸ‘ I’ve used it

❀️ I use it all the time

Choose an emoji from Reactions

/home/pao/Documents/thesis
β”œβ”€β”€ abstract.R
β”œβ”€β”€ thesis.Rmd
β”œβ”€β”€ thesis_reviwed.Rmd
β”œβ”€β”€ thesis_reviwed2.Rmd
β”œβ”€β”€ thesis_final.Rmd
β”œβ”€β”€ thesis_finalfinal.Rmd
β”œβ”€β”€ this_is_it.Rmd
β”œβ”€β”€ now_this_is_it_for_real_this_time_i_swear.Rmd
└── FINAL.Rmd
The figure shows the states of a file: untracked or tracked. When it is tracked by the repository, the file can be staged, committed or modified. With the add action the file is 'staged', with the commit action the file is 'saved' to the repository. This cycles repeats teach time the file is modified.
Concept model of a workflow using RStudio projects and git. Files are added to the staging area, and then commited to the local repository. You can push commits to the remote repository and pull new commits to your computer.

Branches: main

Branches

Scenario 1

Concept model of the workflow in scenario 1. The remote repository is copied into a local repository with a 'clone'. Files inside the local repository and the remote repository are synced with push and pull. The owned remote repository can be merged into the foreign remote repository with a pull request.

Scenario 2

Concept model of the workflow in scenario 2. A foreign remote repository can be forked to an owned remote repository with a 'fork'. The remote repository is copied into a local repository with a 'clone'. Files inside the local repository and the remote repository are synced with push and pull. The owned remote repository can be merged into the foreign remote repository with a pull request.

How familiar are you with R package development?

😯 I don’t have a clue.

πŸ‘ I’ve created a few functions.

πŸ‘ I’ve use the R package structure.

❀️ I maintain one or more R packages.

Choose an emoji from Reactions

rrtools level 1: project structutre

  1. rrtools::use_compendium()
  • Creates the file structure for a research project
  1. rrtools::use_readme_qmd()
  • Adds a README file with a very useful template
    • DOI, How to cite, How to use/reproduce the project
  1. rrtools::use_analysis()
  • Creates a folder structure inside the project with sub folders:
    • paper, figures, data (with raw_data and derived_data sub folders) and templates

rrtools level 2: organising code

  • Simple solution: include everything on the .Rmd file.
    • Cons: it can be a lot to include in 1 file
  • Another simple solution: source from 1 or more .R files
    • Cons: hard to manage (documentation, dependencies, etc)
  • rrtools solution: use an R package structure
    • Cons: sounds like a lot of work at the beginning

Preparations for day 3:

  1. Managing R dependencies with renv
    • Make sure you have the renv package installed.
  2. Sharing your data