Overview:

We will develop and discuss the semester long project throughout the semester. And, I will add more detail and instructions to the project on this page.

A major component will be using the R package pkgdown to create a website (and more) to act as a portfolio for communicating and displaying the work you do this semester.

Last semester you completed your lab work as .Rmd documents, uploaded them to a Github Repository, and submitted the link to your repository to Blackboard. This semester will be similar, except we will be using an R package project structure, and saving the lab work in a specific folder called vignettes, and compiling your work to present it in the form of a website.

For now, watch this getting starting video to review the process. I will go over the details many times in class as well.

Example Semester Project

I will be building my own semester project throughout the semester. This code-base can act as working example code for you. My semester project will be located here:

https://github.com/CrumpLab/SemesterProject7709

R Basics tab

The purpose of this component of the semester long project is for you to demonstrate basic command of fundamental R programming skills. Consider this a litmus test for yourself. If you can confidently provide working code for each item, then you will also be creating a resource for your future self in case you forget how these elements of R programming work. If you find yourself struggling to produce working code for each item, then you have identified some basic skills to practice this semester.

This is a semi open ended component. I will provide the following list of basic R skills. Your task is to write working code demonstrating usage of these skills. It is up to you how to demonstrate you understand the skills. To provide an example, refer to the reference code tab on the course website. Here, I have written working code to demonstrate basic operations in R. One way to complete this component, could be to make a similar reference page showing working code for each of the following items.

Demonstrate your understanding of and ability to use:

  1. Different object types, including vectors and data.frames. Also, demonstrate your knowledge of at least two or more object types that are not vectors or data.frames.

  2. Loops. There are multiple ways to iterate in R. Demonstrate at least two ways, including a FOR loop. Show that you know how to break a loop. Highlight one thing about loops in R that was not obvious to you, or you think might not be obvious to someone else.

  3. Logic. Show that you understand logical operations in R. Show that you know how to use logical operations for indexing. For example, use logical operations to index a vector, and to index a data.frame.

  4. Loops and logic. Demonstrate that you can combine loops and logic to solve some problem. For example, use loops and logic to solve the fizz buzz problem.

  5. Pick at least one advanced problem from this list of problems, and show that you can solve it in R.

https://crumplab.github.io/programmingforpsych/programming-challenges-i-learning-the-fundamentals.html

For maximum fun, pick the snakes and ladders problem. I know you can do it.

  1. Write a function, include it in your R package, show that it works. FYI, I will help with this one. You will be writing a new function, putting it in your R folder (in our R package folder structure). You will make documentation for the function (I will show you how). You will build your R package, which will make the R function available to your instance of R. That means, that you can load your own package as a library (in this .rmd that you are writing your answers in), and you can show that you can use your R function right here.

  2. Do one thing in R that you want to learn how to do (or refresh your memory, or clarify for yourself, or whatever), and that you think your future self would thank yourself for making working code that you can consult later on. Do it, then wait a while (after this course is over), then thank your previous self for doing such a fine job.

Slide Decks

It is possible to create slide decks using Rmd documents. Multiple output formats are supported including, pdf, html, and powerpoint. See this page for more information https://rmarkdown.rstudio.com/lesson-11.html.

To complete this portion of the semester long project you should:

  1. Create a slide deck using one of the above methods
  2. Save your slide deck to a folder called “slides” in your project folder
  3. Create a new tab on your website, and link to the html for your slide show. NOTE: you will have to make sure your final product gets saved to the docs folder too.

R Package

We are using the pkgdown library to generate websites for the semester long project. The pkgdown library was created to automatically generate websites for R packages. The last component of your semester long project is to create an R package:

  1. Add custom functions to the R folder
  2. Add function documentation to the man folder
  3. Be able to install your R package
  4. Show that you can use a function in your R package, for example create a vignette to demonstrate the use of a function

The best resource I have found for authoring are packages is the book by Hadley Wickham and Jenny Bryan called R packages here is the link:

https://r-pkgs.org

And here are a few short tutorial videos I put together showing some basic tips for adding functions to your own R package: