Skip to content

DACSS/DACSS601Fall21

Repository files navigation

DACSS Course Blog Template

This is the generic DACSS course blog hosted on GitHub pages. Students will create a templated repository, work in RStudio to create new posts, and then commit and push the changes prior to submitting a pull request to main repository.

Setup and run course blog (for Instructors)

You may use blogbuilder, an R package designed to create and manage DACSS course blogs. Here is the package's documentation. A useful video to help during setup is provided below.

If this is your first time setting up a DACSS course blog repository, or if you have forgotten how, please skip ahead and get the repository setup (directions at bottom of Read Me. The instructions for regular assignment submissions are provided first for ease of reference.

Weekly Workflow (for Students)

Creating a New Post with Distill

You can create a post by using the create_post function from Distill. It takes in multiple arguments, with title being required. It is also required to utilize draft = TRUE; this ensures that the posts you create does not update the entire site.

For example I can do:

distill::create_post(title = "[INSERT POST TITLE]", author = "Your Name", draft = TRUE)

The command will automatically generate an R Markdown file for you to edit and use as a template for your post. Now, you can edit the file to your liking.

Note: I would recommend updating the header description and add categories:

iris

Categories will be important as it's content will be used as labels for posts. This will become apparent later on.

Knit the R markdown file

Once you are done, simply knit the file as a distill_article.

knit

You will recieve an output preview of what your post will look like.

Commit and Push to Github

Once you are done, commit and push your changes to your repo. Make sure you pull first, prior to commiting, so that there are no conflicts during the commit.

gitCommit

Making a Pull Request to the Main Repo

Once you are done with everything, you may submit a pull request to the main repo (from where you forked the repo on your account). Head over to the blog repo and click the Pull requests button.

pr

Then when your on the next page, click the green New pull request button. Afterwards, click the blue compare accross forks link.

compare

Edit the head repository to your repo.

head

Once you've done that, create a new pull request.

new pr

Add some comments on what this pull request does. For example, in mine I added a new post about the iris dataset and created my about me page. Once you're done click the Create pull request button.

That's it! Wait for the instructor to review your pull request. They will give you feedback and if they approve your request, all your changes will be reflected on the main repo and website!

Setup R Course Blog

Prerequisites

Note: You can see Git and RStudio Setup to satisfy all the following prerequisites:

  • You are required to have Git configured on your computer.
  • You are required to have a Github account.
  • You need to know the basics of git with RStudio.
  • Optional: We recommend using RStudio and assume that you already have it installed.

Git and RStudio Setup

  • You may see this article or utilize the following video. Note that there have been minor changes since the time the video was created. Students no longer need to use the "iamstudent()" command.

    Git Guide

  • Learn the basics of Github with RStudio here.

Forking the Repository

First you will need to fork the repository. You can do that by clicking the Fork icon on the top right corner of the course repo page.

fork

If prompted to choose a user, choose your main GitHub account.

After you have forked the repo, you will have your 'own' version of the repo page to edit and any changes made to this repo will not affect the main course blog repo. Before heading over to RStudio and making changes, make sure to clone the repo by using the repo HTTP link with a new RStudio project.

Create a new R Project for the Course

First, copy the URl for your repository before switching back to RStudio.

repoUrl

Create a new R project, using the copied github URL. See video for more detailed instructions.

RStudio Project

R Package Requirements

You will need to have the devtools, blogbuilder, distill and postcards packages first.

  • devtools is used to manage packages. We will be using it to install the blogbuilder package.
  • blogbuilder is used to manage the course blog as a whole. You will not be using much of this package as it was primarily built to provide instructors easy control over the course blog.
  • Distill will enable you to make posts to the blog.
  • Postcards will enable you to create a personalized 'About Me' page for the blog.

Make sure you install the packages with install.packages and devtools with the commands below. You can enter these into the R console.

install.packages('devtools')
devtools::install_github('DACSS/blogbuilder')
install.packages("distill")
install.packages('postcards')

And load the libraries before proceeding further, again using the console for now. Remember to call these libraries each time you open your R project.

library(blogbuilder)
library(distill)
library(postcards)

Creating an About Me Page with Postcards

You can create an About Me page by using the create_postcard function. If your instructor has already created a page for you, you may skip this step.

Here are examples of themes you can use.

# Four different themes you can use. Choose only one!
postcards::create_postcard(file = "users/[your-name].Rmd", template = "jolla")

postcards::create_postcard(file = "users/[your-name].Rmd", template = "jolla-blue")

postcards::create_postcard(file = "users/[your-name].Rmd", template = "trestles")

postcards::create_postcard(file = "users/[your-name].Rmd", template = "onofre")

Choose one from the commands above. Make sure to replace [your-name] with your name (without the square brackets surrounding it and raplace space or any other special character with '-').

For example:

postcards::create_postcard(file = "users/Hans-Qiogue.Rmd", template = "jolla")

A file will be generated for your about page. Be sure to edit the page to your liking. You may view what your page looks like by knitting the page as postcards.

You can store your image in the users folder and use the image name as the value for the image field in your rmarkdown file's metadata.

postcards

Like before, once you are done, commit and push all the new generated and modified files to your repo.

Releases

No releases published

Packages

No packages published

Languages