A brief guide how to contribute content.
The primary goal of Open Source Football is to make football-related analysis and corresponding code publicly available. To achieve this, we need volunteers who are willing to make a contribution.
Articles posted on Open Source Football are authored using Distill for R Markdown. If you would like to contribute, you’ll need to have installed R and R Markdown. However, this does not mean that are limited exclusively to R code because R Markdown supports many other languages as well! You’ll need R and R Markdown to create the post and the formal structure but the most important thing - your code and its output - can be anything compatible with R (please see Ben’s python contributing example).
This guide is intended to help all contributors prepare articles for publishing. If you have questions or think something is unclear or wrong please create an issue and we will look into it.
Here is a very brief overview of what is needed. The next section will have much more detail on each of these steps.
The steps below assume that you have RStudio and git (I highly recommend Hadley’s git section in “R packages”) installed.
Contributing to someone else’s package or project became much more convenient with the usethis pull request helpers. We will use these in the following sections, so please read the linked article.
With the last step we will be notified and will take a look at your article, suggest changes as necessary, then publish it when it’s ready by merging it into the main repository.
Before you start, don’t forget to read the article on usethis pull request helpers.
Install the packages distill
, usethis
and rmarkdown
with
install.packages(c("distill", "usethis", "rmarkdown"))
Important!
Rendering of the site will fail or be incomplete if an outdated version of distill
is installed, so please check if you have installed distill >= 1.0
by running
paste0("You are running distill v", utils::packageVersion("distill"))
[1] "You are running distill v1.6"
The “Fork” is your own copy of the Open Source Football Github Repository. You can clone it to get your own local copy. There are many ways to accomplish these two steps, but I highly recommend
usethis::create_from_github("nflverse/open-source-football")
This will fork the repo, clone it to your computer and open the project in a new RStudio session. Click here for more details.
The process of contributing starts now by creating a new branch (please try to choose a descriptive name). It is good practice to make your changes in a new branch instead of the main branch, so please make sure not to skip this step.
usethis::pr_init(branch = "bens-apa-tiers")
Create the new article by running
distill::create_post("Title of your post")
This will create a new folder in _posts
and name it with the current date and
your chosen title. Additionally the RMarkdown file in which you will write your
post will be opened automatically. It will look something like this
We need to tweak the metadata as well as the chunk setup a little bit in order for the post to meet our expectations. Please have a look at example file for a little template.
Now you are ready to write your post. Please see Distill for R Markdown as well as some of the already published posts. And if you feel like you need more information about R Markdown please feel free to check the R Markdown Cookbook.
Using git within RStudio is easy because you can do it graphically. However, it doesn’t make sense to provide a ton of screenshots and text here. Instead I recommend two sources:
Commit all files which are related to your post and go on with the last step. There are 4 files not related to your post which may cause merge conflicts when you push them without updating them before your pull request. To avoid this, please run the following code right before you commit all your files:
source("https://raw.githubusercontent.com/nflverse/open-source-football/master/_update_con_files.R")
If you forget this step, you can still create the pull request and GitHub
will inform you of the conflicts. If there are conflicts, run the above line, then commit and
push the updated files: docs/index.html
, docs/index.xml
, docs/posts/posts.json
, and
docs/sitemap.xml
.
The following code pushes any local changes of your code to GitHub and puts you in position to make your pull request:
usethis::pr_push()
This launches a browser window with the prepared pull request on Github. You will have to click “Create pull request”, add some description, and finally submit it. Click here for more details.
Now you are done. We will start reviewing your pull request and make sure to publish it. Thanks for your contribution!
If you see mistakes or want to suggest changes, please create an issue on the source repository.
Text and figures are licensed under Creative Commons Attribution CC BY-NC 4.0. Source code is available at https://github.com/nflverse/open-source-football, unless otherwise noted. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".