Scientific reproducibility: What is it for?


Figure 1

PhD Comics cartoon

Figure 2

Nature Report - 2016

Figure 3

Science is not a miracle

Figure 4

How science should be

Figure 5


Good Practices for Managing Projects in RStudio


Figure 1

directory tree

Navigating RStudio and Quarto Documents


Figure 1

RStudio layout

Figure 2

RStudio layout with .R file open

Figure 3

Name new .qmd file

Figure 4

.qmd new file generic template

Figure 5

Add image source editor

Figure 6

Note that both the visual and the source editors offer the option to display an outline of your document image which make it easier to navigate long documents.


Working with projects in RStudio


Figure 1

new r project options

Figure 2

quarto projects

Figure 3

New directory

Figure 4

Then, to use version control, make sure to check the “Create a git repository” box as highlighted in this screenshot: new project w/ version control


Figure 5

existing project

Figure 6

version controlled The final option is to continue a version-controlled project. This is the option we will do for our workshop.


Figure 7

Git or Subversion

Figure 8

continue project from GitHub

Figure 9

GitHub

Figure 10

fork on GitHub

Figure 11

copy GitHub repository url

Figure 12

start my R project

Figure 13

Git not detected on system path

Figure 14

To set it up, we need to go to Tools > Global Options Global Options Git/SVN setup


Figure 15

  • Menu bar (Tools menu) Git menu bar

  • Figure 16

  • Environment/History pane git environment panel

  • Figure 17

    git add commit workflow

    Figure 18

    git panel add

    Figure 19

    git panel add

    Figure 20

    git panel icons

    Figure 21

    commit in RStudio

    Figure 22

  • Open the .gitignore file by double-clicking on it in the file view pane; on a new line add data/. Save the file, and don’t forget to commit it. .gitignore file

  • Figure 23

  • Click on the settings gear in the Git tab of the environment pane. Click on gitignore. On a new line, add data and click save. Don’t forget to commit the .gitignore file. .gitignore in git pane

  • Introduction to Working with Quarto documents


    Figure 1

    Quarto Workflow

    Figure 2

    yaml highlighted in document

    Figure 3

    qmd template text


    Figure 4

    Render html output


    Writing and Styling Qmd Documents


    Figure 1

    Fig. 6.1 - Toolbar

    Figure 2

    Fig. 6.2 - Menu

    Figure 3

    Clear Formatting Option

    Figure 4

    Fig. 6.3 - Shortcuts

    Figure 5

    Text with borders rendered


    Figure 6

    Two columns rendered


    Adding Code to Quarto Documents


    Figure 1

    auto create code chunk

    Figure 2

    blank qmd code chunk

    Figure 3

    run from code chunk

    Figure 4

    run code menu

    Figure 5

    directory error code chunk

    Figure 6

    path error details

    Figure 7

    Code Chunk Plot Preview

    Rendering & Customizing Code Outputs


    Figure 1

    Heart rate code no options for code chunk

    Figure 2

    code chunk label

    Figure 3

  • fig-alt: (NULL; character) The alternative text to be used in the alt attribute of the tags of figures in HTML output. By default, the chunk option fig-cap will be used as the alternative text if provided.

  • Figure 4

    Error due to wrong order

    Advanced Code Chunk Options


    Figure 1

    Project Options

    Figure 2

    Quarto yml project setting

    Figure 3

    basic code chunk

    Figure 4

    03-HR-analysis.R externally sourced in Qmd Document

    Bibliography, Citations & Cross-Referencing


    Figure 1

    Citation Window

    Figure 2

    references.bib

    Figure 3

    Salviary Cortisol

    Figure 4

    DOI Lookup

    Figure 5

    Inserting cross-referencing


    Using Git in RStudio


    Figure 1

  • Menu bar (Tools menu) Git menu bar

  • Figure 2

  • Environment/History pane git environment panel

  • Figure 3

    git add commit workflow

    Figure 4

    git panel add

    Figure 5

    git panel icons

    Figure 6

    commit in RStudio

    Figure 7

  • Open the .gitignore file by double-clicking on it in the file view pane; on a new line add data/. Save the file, and don’t forget to commit it. .gitignore file

  • Figure 8

  • Click on the settings gear in the Git tab of the environment pane. Click on gitignore. On a new line, add data and click save. Don’t forget to commit the .gitignore file. .gitignore in git pane

  • Collaborating via GitHub


    Figure 1

    PAT options on GitHub

    Figure 2

    Copy Repo URL from GitHub

    Figure 3

    RSTudio Project Options Git/SVN

    Managing Dependencies in R/RStudio


    Publishing your project


    Figure 1

    Publish button in RStudio

    Figure 2

    Publish to RPubs or RStudio Connect

    Figure 3

    Confirm Publish to RPubs

    Figure 4

    Quarto Pub Publish command

    Figure 5

    Quarto Pub Publish Example


    Figure 6

    RStudio output formats

    Figure 7

    Journal-Templates


    Creating and sharing reproducible environments with renv


    Figure 1

    Understanding how the R System works

    Figure 2

    Project local library

    Figure 3

    Renv for new project

    Figure 4

    Environments

    Figure 5

    Anatomy of a renv.lock file

    Figure 6

    Renv