Reading

Tasks

  • Create repository for final project
  • Explore various options for your project website
  • Push changes back to GitHub
  • Enable website on GitHub

Overview

One convenient way to share research details is through a public website that includes all the information needed to reproduce the project. You will do this for your final project.

Today we will make a copy of a template for your final project, edit it, and ‘push’ it back up to your github account. You can check out the template code at https://github.com/AdamWilsonLabEDU/geo511_project and the template website at https://adamwilsonlabedu.github.io/geo511_project/

R Markdown

Cheatsheet:

alt text

Libraries

library(rmarkdown)
library(knitr)

Create a copy of the project template.

Steps:

  1. Click on this link to make a copy of the project template.
  2. Open your new repository in GitHub. It will look something like https://adamwilsonlabedu.github.io/GEO511_QuartoProjectTemplate/
  3. Click the green button “Clone or Download” and copy the URL.

Clone the project template to your computer

Now you will make a local copy on your computer by creating a new project and ‘cloning’ the repository you just forked.

  1. Open RStudio
  2. File -> New Project -> Version Control -> Git
  • URL: paste from above. It will be similar to https://adamwilsonlabedu.github.io/GEO511_QuartoProjectTemplate/ but with your username.
  • Project name: you can rename it if you want or keep the default.
  • Project as subdirectory of ~/Documents or wherever you want to put it.
  1. It should download the project to your computer then open it to the index.Rmd file.

Play with the project template

  1. Select the Build tab in the upper right corner of RStudio, then click Build Website
  2. Check out the website settings in _quarto.yml. These adjust the appearance, title, etc. You can also change the default menu organization if you want to add additional pages or other content. If you only have one page you probably won’t need to adjust this information.

Push to GitHub and enable the website

  1. Select the Git tab in the upper right and notice how it keeps track of any changes.
  • To ‘commit’ the files (which is like saving them), check the files you want to commit (or all of them) and click commit.
  • Type in a brief message about the changes you made. Maybe something like “First update to my project materials”
  • Click Commit, then close.
  • Click Push to push it back up to GitHub.
  1. Now go to your repository website (similar to https://adamwilsonlabedu.github.io/GEO511_QuartoProjectTemplate/
  2. Publish your website
    • Click settings in the upper right, then select the Pages section
    • Change “Branch” to gh-pages / (root) folder and click Save
    • Copy your new site’s URL to your clipboard
    • Go back to the ‘Code’ tab for your project repository and find the line “No description, website, or topics provided” and click “Edit” on the right as shown in the following figure.
    • Paste the URL in the “Website” box. This will make it easier for others to find your website.
  3. Go to your new project webpage. It can take ~5 minutes to appear after enabling.
  4. Now you can commit and then push your updates from RStudio and your website will be updated.

GitHub actions

The template is set up to compile remotely using GitHub actions. This will make sure that your code is reproducible.

RENV

The website is set up to use RENV to manage packages needed to run your code. If you add any packages, you will also need to update the renv file by running renv::snapshot() and pushing the changes to github. See https://rstudio.github.io/renv/articles/ci.html for me.

Explore quarto functions

  1. Use the Cheatsheet to explore functionality of quarto.
  2. Add more figures or different versions of a figure
  3. Check out the kable() function for tables (e.g. kable(head(d)))

Abandoning the habit of secrecy in favor of process transparency and peer review was the crucial step by which alchemy became chemistry.Raymond, E. S., 2004, The art of UNIX programming: Addison-Wesley.