Final Project

The climax of this course is its final project. The final project is your opportunity to take your newfound savvy with R for a spin and develop your very own package. We ask that you build something of interest to you, that you solve a substantive problem, that you positively impact others, or that you change the world. Strive to create something you’re proud of.

Since software development is rarely a one-person effort, you are allowed an opportunity to collaborate with one or two classmates for this final project. Needless to say, it is expected that every student in any such group contribute equally to the design and implementation of the project. Moreover, it is expected that the scope of a two- or three-person group’s project be, respectively, twice or thrice that of a typical one-person project. Although no more than three students may design and implement a given project, you are welcome to solicit advice from others, so long as you respect the course’s policy on academic honesty.

Ideas

The ideas for what you could build are endless, though to get your thinking started, a few others have attempted projects like the below!

  • A package to speed up data analysis tasks you find yourself commonly repeating (à la the tidyverse or janitor packages)
  • A package to create or analyze music files (à la the gm or tuneR packages)
  • A package to do something whimsical, surprising, or fun (à la the fortunes or spongebob packages)

Getting Started

Project Folder

To provide you some structure with which to start building your package, we’ll give you a folder that contains the DESCRIPTION, LICENSE, and NAMESPACE files you need. Start by downloading the project folder.

Download the project folder

Open RStudio per the linked steps and navigate to the R console:

>

Next execute

getwd()

to print your working directory. Ensure your current working directory is where you’d like to download this problem’s distribution code. If using RStudio through cs50.dev the recommended directory is /workspaces/NUMBER where NUMBER is a number unique to your codespace.

If you do not see the right working directory, use setwd to change it! Try typing setwd("..") if in the working directory of another problem, which will move you one directory higher.

Next execute

download.file("https://cdn.cs50.net/r/2024/x/project/project.zip", "project.zip")

in order to download a ZIP called project.zip into your codespace.

Then execute

unzip("project.zip")

to create a folder called project. You no longer need the ZIP file, so you can execute

file.remove("project.zip")

Now type

setwd("project")

followed by Enter to move yourself into (i.e., open) that directory. Your working directory should now end with

project/

If all was successful, you should execute

list.files()

and see DESCRIPTION, LICENSE, and NAMESPACE. If not, retrace your steps and see if you can determine where you went wrong!

Of course, you’ll likely want to rename your final project’s folder from project to the name of your package. You can do so by using:

file.rename("OLD", "NEW")

where “OLD” is the old folder name and “NEW” is the new folder name, each in quotes. When you do this, just be sure your project folder is in your working directory and is not your current working directory itself.

Specification

At a high level, your final project should be an R package that includes at least 3 functions, with documentation and rigorous tests. To be more specific, your final project should include all of the following:

  • A complete DESCRIPTION file
  • A complete NAMESPACE file
  • A complete LICENSE file, if appropriate
  • At least 3 .R files in a folder named R, each one defining 1 function that is part of your package
  • At least 3 .Rd files in a folder named man, each one documenting 1 of the functions you’ve implemented
  • At least 3 .R files in a folder named tests, each one testing 1 of the functions you’ve implemented
  • A video overview of your package

The requirements for each of these components are described in more detail below.

DESCRIPTION

Your DESCRIPTION file should be at least 100 characters long and contain the URL to your video overview in the Video field.

NAMESPACE

You NAMESPACE file should export all functions from your package you’d like others to be able to use.

LICENSE

If needed, your LICENSE file should provide additional information about the license you’ve chosen.

R folder

Your R folder should include at least 3 .R files, each with a function definition inside of them.

man folder

Your man folder should include at least 3 .Rd files, with at least these required components:

  • A name attribute
  • A description attribute
  • A usage attribute
  • An arguments attribute
  • A value attribute
  • An examples attribute

tests folder

Your tests folder (or a subfolder of it) should contain at least 3 .R files to test your functions from your R folder.

Video Overview

Create a short video (that’s no more than 3 minutes in length) in which you present your project to the world, as with slides, screenshots, voiceover, and/or live action. Your video must begin with an opening section that displays:

  • your project’s title;
  • your name;
  • your GitHub and edX usernames;
  • your city and country;
  • and, the date you have recorded this video.
  • See howtogeek.com/205742/how-to-record-your-windows-mac-linux-android-or-ios-screen for tips on how to make a “screencast,” though you’re welcome to use an actual camera. Upload your video to YouTube (or, if blocked in your country, a similar site) and take note of its URL; it’s fine to flag it as “unlisted,” but don’t flag it as “private.”

Sample Project

If you’d find it helpful to see a sample project, consider exploring the staff’s own! The sample project is a package called ducksay, which gives users access to functions like ducksay, cowsay, and fishsay.

Download the sample project

Open RStudio per the linked steps and navigate to the R console:

>

Next execute

getwd()

to print your working directory. Ensure your current working directory is where you’d like to download this problem’s distribution code. If using RStudio through cs50.dev the recommended directory is /workspaces/NUMBER where NUMBER is a number unique to your codespace.

If you do not see the right working directory, use setwd to change it! Try typing setwd("..") if in the working directory of another problem, which will move you one directory higher.

Next execute

download.file("https://cdn.cs50.net/r/2024/x/project/ducksay.zip", "ducksay.zip")

in order to download a ZIP called ducksay.zip into your codespace.

Then execute

unzip("ducksay.zip")

to create a folder called ducksay. You no longer need the ZIP file, so you can execute

file.remove("ducksay.zip")

Now type

setwd("ducksay")

followed by Enter to move yourself into (i.e., open) that directory. Your working directory should now end with

ducksay/

If all was successful, you should execute

list.files()

and see the package’s contents. If not, retrace your steps and see if you can determine where you went wrong!

How to Submit

Step 1 of 3

Submit this form!

Step 2 of 3

Keeping in mind the course’s policy on academic honesty, run the following command in the RStudio console:

submit50("cs50/problems/2024/r/project")

Step 3 of 3

Be sure to visit your gradebook at cs50.me/cs50r a few minutes after you submit. It’s only by loading your Gradebook that the system can check to see whether you have completed the course, and that is also what triggers the (instant) generation of your free CS50 Certificate and the (within 30 days) generation of the Verified Certificate from edX, if you’ve completed all of the other assignments. Be sure to claim your free certificate (by following the link at the top of your gradebook) before 1 January 2025.

That’s it! Your project should be graded within a few minutes. If you don’t see any results in your gradebook, best to resubmit (running the above submit50 command). No need to resubmit your form.

This was CS50R!