Fall 2020 EDAV Community Contributions
2020-12-12
Chapter 1 Instructions
This chapter gives you all the information you need to upload your community contribution. Please read this entire document carefully before making your submission. Of particular note is the fact that bookdown requires a different .Rmd format than you’re used to, so you must make changes to the beginning of the file as described below before submitting.
1.1 Background
This web site makes use of the bookdown package to render a collection of .Rmd
files into a nicely formatted online book with chapters and subchapters. Your job will be to submit a slightly modified version of your community contribution .Rmd
file to the GitHub repository where the source files for this web site are stored. On the backend, the admins will divide the chapters into book sections and order them.
If your community contribution is in a different format, then create a short .Rmd
file that explains what you did, and includes links to any relevant files, such as slides, etc. which you can post on your GitHub repo (or another online site.)
1.2 Preparing your .Rmd
file
You should only submit ONE Rmd
file.
After completing these modifications, your .Rmd
should look like this sample .Rmd
.
Create a concise, descriptive name for your project. For instance, name it
base_r_ggplot_graph
or something similar if your work is about contrasting/working with base R graphics and ggplot2 graphics. Check the.Rmd
filenames in the project repo to make sure your name isn’t already taken. Your project name should be words only and joined with underscores, no white space. Use.Rmd
not.rmd
. In addition, all letters must be lowercase. Create a copy of your.Rmd
file with the new name.Completely delete the YAML header (the section at the top of the
.Rmd
that includes name, title, date, output, etc.) including the---
line.Choose a short, descriptive, human readable title for your project as your title will show up in the table of contents – look at examples in the 2019 EDAV rendered book of community contributions https://jtr13.github.io/cc19. Capitalize the first letter only (“sentence case”). On the first line of your document, enter a single hashtag, followed by a single whitespace, and then your title. It is important to follow this format so that bookdown renders your title as a header. Do not use single
#
headers anywhere else in the document. Note: if your chapter is the first in a section, a second#
header and section description will be requested during the pull-request and merge phase.The second line should be blank, followed by your name(s):
# Base R vs. ggplot2 Aaron Burr and Alexander Hamilton Your content starts here.
If your project requires data, please use a built-in dataset or read directly from a URL, such as:
df <- readr::read_csv("https://people.sc.fsu.edu/~jburkardt/data/csv/addresses.csv")
If you absolutely must include a data file, please use a small one, as for many reasons it is desirable to keep the repository size as small as possible.If you have included a
setup
chunk in yourRmd
file, please remember to remove the labelsetup
in the chunk, i.e., use:{r, include=FALSE}
instead of:
{r setup, include=FALSE}
If your project requires libraries to be installed and included in the document, please adhere to the following conventions. Do not evaluate any
install.packages()
statements in your document. Consumers of anRmd
file won’t want packages to get installed when they knit your document. Include anylibrary()
statements at the top of yourRmd
file, below the title, name, andsetup
, but above any content. If your chapter requires the installation of a package from source (is a GitHub installation), please add a comment identifying it as such. Here is an examplelibrary()
section with install statements that won’t be evaluated:
You could include both sections, or you could just include the second library()
section and trust R users to install any packages themselves. If you developed your Rmd
file before moving your library()
statements above the rest of the file content, it is highly recommended to knit and review your document again. This may change the namespace that was available in each section of your code during development, causing a function not to work or to exhibit unexpected behavior. This common issue is mentioned in the EDAV R Basics “Functions stop working” section.
- Your file should not contain
getwd()
/setwd()
calls (you should never use these in scripts anyway!) norwrite
statements.
Want to get fancy? See the optional tweaks section below.
1.3 Submission steps
To submit your work, we will be following “Workflow #4” – that is submitting a pull request to someone else’s repository to which you do not have write access. Instructions are available in this tutorial. They are repeated below in abbreviated form, with specific instructions on naming conventions, content information, and other important details.
Fork cc20 repo (this repo) to your GitHub account.
Clone/download the forked repo to your local computer.
Create a new branch and name it with your project name, in our case
sample_project
. Do not skip this step. We will not merge your PR if it doesn’t come from a branch. If you already forgot to do this, check this tutorial for how to fix it.Copy your modified
.Rmd
file with the same name into the root directory on the branch. In our example, it issample_project.Rmd
.Do not include an
.html
file. (In order for the bookdown package to work, all.Rmd
files will be rendered behind the scenes.)[OPTIONAL] If you have other resources (such as images) included in your project, create a folder under
resources/
. In our example, it isresources/sample_project/
. Put the resources files there. Be sure to change all the links in your.Rmd
to includeresources/.../
, for example:![Test Photo](resources/sample_project/election.jpg)
When you are ready to submit your project, push your branch to your remote repo. Follow this tutorial to create a pull request.
At this point a back and forth will begin with the team managing the pull requests. If you are asked to make changes, simply make the changes on your local branch, save, commit, and push to GitHub. The new commits will be added to your pull request; you do not need to, and should not, create a new pull request. (If, based on the circumstances, it does make sense to close the pull request and start a new one, we will tell you.)
Once your pull request is merged, it’s fine to delete your local clone (folder) as well as the forked repository in your GitHub account.
1.4 Optional tweaks
If you prefer for links from your chapter to open in new tabs, add
{target="_blank"}
after the link, such as:[edav.info](edav.info){target="_blank"}
Note that your headers (
##
,###
, etc.) will be converted to numbered headings as such:
##
–> 3.1
###
–> 3.1.1
These headings will appear as chapter subheadings and sub-subheadings in the navigation panel on the left. Think about a logical structure for users to navigate your chapter. We recommend using only##
and###
headings since “sub-sub-subheadings” such as 4.1.3.4 are generally unnecessary and look messy.Unfortunately, there’s no simple way to preview your chapter before it’s actually merged into the project. (bookdown has
preview_chapter()
option but it only works after the entire book has been rendered at least once and that will become more and more complex and require more and more packages as the project grows.) If you really want to preview it, fork and clone this minimal bookdown repo, add your.Rmd
file, click the “Build book” button on the Build tab (next to Git), and then open any of the.html
files in the_book
folder in a web browser to see the rendered book. (Do not click the Knit button as it will not build a bookdown book.)
If you’re interested in more bookdown options, see the official reference book.
Have more useful tweaks to share? Submit an issue or PR.
1.5 FAQ
1.5.1 What should I expect after creating a pull request?
Within a week after you create a pull request, we will apply a label to it and assign an administrator who will review all the files you submit to see if they meet the requirements.
It will take some time before we can process all the pull requests, so as long as you see your pull request has been labeled and assigned to an admin, don’t worry.
However, if the admin contacts you regarding the pull request, that usually means your files fail to meet some requirements. The admin will clearly state what is wrong, so please fix them as soon as possible.
1.5.2 What if I catch mistakes before my pull request is merged?
Just make the changes on your branch, commit and push them to GitHub. They will automatically be added to the pull request.
1.5.3 What if I catch mistakes after my pull request is merged?
You may submit additional pull requests to fix material on the site. If the edits are small, such as fixing typos, it is easiest to make the edits directly on GitHub, following these instructions. We will merge first pull requests before edits, so please be patient.
1.5.4 Other questions
If you encounter other problems, please submit an issue and we will look into it.
Thank you for your contributions!